summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-02-19 16:16:42 +0100
committerwm4 <wm4@nowhere>2014-02-19 16:16:42 +0100
commit844efa54313b395750d139abcea9425e9f4ee6f9 (patch)
treeea89e27e6fa1f6a61b979793abeee1b35edccf1e
parent15fa1202229b149cc52448535f7fcd0e7f6aba08 (diff)
downloadmpv-844efa54313b395750d139abcea9425e9f4ee6f9.tar.bz2
mpv-844efa54313b395750d139abcea9425e9f4ee6f9.tar.xz
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.
-rw-r--r--DOCS/man/en/input.rst10
-rw-r--r--player/command.c5
2 files changed, 12 insertions, 3 deletions
diff --git a/DOCS/man/en/input.rst b/DOCS/man/en/input.rst
index c23685848d..4077d22e83 100644
--- a/DOCS/man/en/input.rst
+++ b/DOCS/man/en/input.rst
@@ -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
diff --git a/player/command.c b/player/command.c
index 83fcef4a61..d9a2b99922 100644
--- a/player/command.c
+++ b/player/command.c
@@ -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) {