mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Migration of CEC-config and have default actions
This commit is contained in:
parent
1e0852c785
commit
e319db7de0
@ -21,7 +21,21 @@
|
||||
"enableAttempts": 6,
|
||||
"enableAttemptsInterval": 15
|
||||
},
|
||||
|
||||
|
||||
"cecEvents": {
|
||||
"actions": [
|
||||
{
|
||||
"action": "Suspend",
|
||||
"cec_event": "standby"
|
||||
},
|
||||
{
|
||||
"action": "Resume",
|
||||
"cec_event": "set stream path"
|
||||
}
|
||||
],
|
||||
"enable": false
|
||||
},
|
||||
|
||||
"color": {
|
||||
"imageToLedMappingType": "multicolor_mean",
|
||||
"channelAdjustment": [
|
||||
|
@ -894,6 +894,44 @@ bool SettingsManager::handleConfigUpgrade(QJsonObject& config)
|
||||
Debug(_log, "LED-Device records migrated");
|
||||
}
|
||||
}
|
||||
|
||||
if (config.contains("cecEvents"))
|
||||
{
|
||||
bool isCECEnabled {false};
|
||||
if (config.contains("grabberV4L2"))
|
||||
{
|
||||
QJsonObject newGrabberV4L2Config = config["grabberV4L2"].toObject();
|
||||
if (newGrabberV4L2Config.contains("cecDetection"))
|
||||
{
|
||||
isCECEnabled = newGrabberV4L2Config.value("cecDetection").toBool(false);
|
||||
newGrabberV4L2Config.remove("cecDetection");
|
||||
config["grabberV4L2"] = newGrabberV4L2Config;
|
||||
|
||||
QJsonObject newGCecEventsConfig = config["cecEvents"].toObject();
|
||||
newGCecEventsConfig["enable"] = isCECEnabled;
|
||||
if (!newGCecEventsConfig.contains("actions"))
|
||||
{
|
||||
QJsonObject action1
|
||||
{
|
||||
{"action", "Suspend"},
|
||||
{"cec_event", "standby"}
|
||||
};
|
||||
QJsonObject action2
|
||||
{
|
||||
{"action", "Resume"},
|
||||
{"cec_event", "set stream path"}
|
||||
};
|
||||
|
||||
QJsonArray actions { action1, action2 };
|
||||
newGCecEventsConfig.insert("actions",actions);
|
||||
}
|
||||
config["cecEvents"] = newGCecEventsConfig;
|
||||
|
||||
migrated = true;
|
||||
Debug(_log, "CEC configuration records migrated");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user