1
mirror of https://github.com/mpv-player/mpv synced 2024-11-18 21:16:10 +01:00

command: move metadata entry access to metadata/by-key/

The old way still works, and is fine to use. Still discourage it,
because it might conflict with other ways to access this property, such
as the one added in the next commit.
This commit is contained in:
wm4 2014-02-19 16:16:42 +01:00
parent 15fa120222
commit 844efa5431
2 changed files with 12 additions and 3 deletions

View File

@ -649,8 +649,14 @@ an option at runtime.
key and value strings separated by ``,``. (If a key or value contains ``,``,
you're screwed.)
``metadata/<key>``
Value of metadata entry ``<key>``.
This has a number of sub-properties:
``metadata/by-key/<key>``
Value of metadata entry ``<key>``.
``metadata/<key>``
Old version of ``metadata/by-key/<key>``. Use is discouraged, because
the metadata key string could conflict with other sub-properties.
``chapter-metadata``
Metadata of current chapter. Works similar to ``metadata`` property. This

View File

@ -801,7 +801,10 @@ static int tag_property(m_option_t *prop, int action, void *arg,
}
case M_PROPERTY_KEY_ACTION: {
struct m_property_action_arg *ka = arg;
char *meta = mp_tags_get_str(tags, ka->key);
bstr key = bstr0(ka->key);
// Direct access without this prefix is allowed for compatibility.
bstr_eatstart0(&key, "by-key/");
char *meta = mp_tags_get_bstr(tags, key);
if (!meta)
return M_PROPERTY_UNKNOWN;
switch (ka->action) {