mpris: Rename dynamic-priority to dynamic-importance-order keeping backward compatibility
This commit is contained in:
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 ++
|
||||
force exclusion.
|
||||
|
||||
*dynamic-priority*: ++
|
||||
*dynamic-importance-order*: ++
|
||||
typeof: []string ++
|
||||
default: ["title", "length", "position", "artist", "album"] ++
|
||||
Priority of the tags when truncating the Dynamic tag (absence in this
|
||||
list means force inclusion).
|
||||
default: ["title", "artist", "album", "position", "length"] ++
|
||||
Priority of the tags when truncating the Dynamic tag. The final ones ++
|
||||
will be the first to be truncated. Absence in this list means force ++
|
||||
inclusion.
|
||||
|
||||
*dynamic-separator*: ++
|
||||
typeof: string ++
|
||||
|
|
|
@ -79,12 +79,13 @@ Mpris::Mpris(const std::string& id, const Json::Value& config)
|
|||
if (config["dynamic-len"].isUInt()) {
|
||||
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();
|
||||
for (auto it = config_["dynamic-priority"].begin(); it != config_["dynamic-priority"].end();
|
||||
++it) {
|
||||
if (it->isString()) {
|
||||
dynamic_prio_.push_back(it->asString());
|
||||
const auto& dynamic_priority = config_["dynamic-importance-order"].isArray() ? config_["dynamic-importance-order"] : config_["dynamic-priority"];
|
||||
for (const auto& value : dynamic_priority) {
|
||||
if (value.isString()) {
|
||||
dynamic_prio_.push_back(value.asString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue