diff options
author | Max Kellermann <max@musicpd.org> | 2018-08-10 18:31:05 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2018-08-10 18:46:47 +0200 |
commit | c46483a4ab2fe0f206473f4907ec35044d18c30a (patch) | |
tree | ff087e0d60efb5620f824c6362c105d3ad6dc177 /src | |
parent | 0f19108ce34ba523b2a652c10879c9e312155426 (diff) |
tag/Config: support incremental "metadata_to_use" setting
With a "+" or "-" prefix, the "metadata_to_use" setting can manipulate
the existing default. This way, one can enable `TAG_COMMENT` without
having to list all the other tags.
Diffstat (limited to 'src')
-rw-r--r-- | src/tag/Config.cxx | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/tag/Config.cxx b/src/tag/Config.cxx index 94899df14..29967dde9 100644 --- a/src/tag/Config.cxx +++ b/src/tag/Config.cxx @@ -34,19 +34,36 @@ TagLoadConfig(const ConfigData &config) if (value == nullptr) return; - global_tag_mask = TagMask::None(); - - if (StringEqualsCaseASCII(value, "none")) + if (StringEqualsCaseASCII(value, "none")) { + global_tag_mask = TagMask::None(); return; + } + + bool plus = true; + + if (*value != '+' && *value != '-') + /* no "+-": not incremental */ + global_tag_mask = TagMask::None(); for (const auto &i : SplitString(value, ',')) { const char *name = i.c_str(); + if (*name == '+') { + plus = true; + ++name; + } else if (*name == '-') { + plus = false; + ++name; + } + const auto type = tag_name_parse_i(name); if (type == TAG_NUM_OF_ITEM_TYPES) throw FormatRuntimeError("error parsing metadata item \"%s\"", name); - global_tag_mask |= type; + if (plus) + global_tag_mask.Set(type); + else + global_tag_mask.Unset(type); } } |