mpris: Rename dynamic-priority to dynamic-importance-order keeping backward compatibility
parent
77a8420aaf
commit
66ce74d29b
|
@ -80,11 +80,12 @@ The *mpris* module displays currently playing media via libplayerctl.
|
||||||
declaration of the first among the two tags. Absence in this list means ++
|
declaration of the first among the two tags. Absence in this list means ++
|
||||||
force exclusion.
|
force exclusion.
|
||||||
|
|
||||||
*dynamic-priority*: ++
|
*dynamic-importance-order*: ++
|
||||||
typeof: []string ++
|
typeof: []string ++
|
||||||
default: ["title", "length", "position", "artist", "album"] ++
|
default: ["title", "artist", "album", "position", "length"] ++
|
||||||
Priority of the tags when truncating the Dynamic tag (absence in this
|
Priority of the tags when truncating the Dynamic tag. The final ones ++
|
||||||
list means force inclusion).
|
will be the first to be truncated. Absence in this list means force ++
|
||||||
|
inclusion.
|
||||||
|
|
||||||
*dynamic-separator*: ++
|
*dynamic-separator*: ++
|
||||||
typeof: string ++
|
typeof: string ++
|
||||||
|
|
|
@ -79,12 +79,13 @@ Mpris::Mpris(const std::string& id, const Json::Value& config)
|
||||||
if (config["dynamic-len"].isUInt()) {
|
if (config["dynamic-len"].isUInt()) {
|
||||||
dynamic_len_ = config["dynamic-len"].asUInt();
|
dynamic_len_ = config["dynamic-len"].asUInt();
|
||||||
}
|
}
|
||||||
if (config_["dynamic-priority"].isArray()) {
|
// "dynamic-priority" has been kept for backward compatibility
|
||||||
|
if (config_["dynamic-importance-order"].isArray() || config_["dynamic-priority"].isArray()) {
|
||||||
dynamic_prio_.clear();
|
dynamic_prio_.clear();
|
||||||
for (auto it = config_["dynamic-priority"].begin(); it != config_["dynamic-priority"].end();
|
const auto& dynamic_priority = config_["dynamic-importance-order"].isArray() ? config_["dynamic-importance-order"] : config_["dynamic-priority"];
|
||||||
++it) {
|
for (const auto& value : dynamic_priority) {
|
||||||
if (it->isString()) {
|
if (value.isString()) {
|
||||||
dynamic_prio_.push_back(it->asString());
|
dynamic_prio_.push_back(value.asString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue