command: allow metadata to be set manually

This commit is contained in:
Mike Will authored and Kacper Michajłow committed 2026-04-18 05:37:38 +02:00
1 parent 4377cce737
commit d0df98f701
3 files changed
+10 -5

No files matched your search

@@ -0,0 +1 @@
make the `metadata/by-key` property writable
+1 -1
View File
@@ -2477,7 +2477,7 @@ Property list
This has a number of sub-properties:
``metadata/by-key/<key>``
``metadata/by-key/<key>`` (RW)
Value of metadata entry ``<key>``.
``metadata/list/count``
+8 -4
View File
@@ -1329,18 +1329,22 @@ static int tag_property(int action, void *arg, struct mp_tags *tags)
// Direct access without this prefix is allowed for compatibility.
bstr k = bstr0(ka->key);
bstr_eatstart0(&k, "by-key/");
char *meta = mp_tags_get_bstr(tags, k);
if (!meta)
return M_PROPERTY_UNKNOWN;
switch (ka->action) {
case M_PROPERTY_GET:
case M_PROPERTY_GET: {
char *meta = mp_tags_get_bstr(tags, k);
if (!meta)
return M_PROPERTY_UNKNOWN;
*(char **)ka->arg = talloc_strdup(NULL, meta);
return M_PROPERTY_OK;
}
case M_PROPERTY_GET_TYPE:
*(struct m_option *)ka->arg = (struct m_option){
.type = CONF_TYPE_STRING,
};
return M_PROPERTY_OK;
case M_PROPERTY_SET:
mp_tags_set_bstr(tags, k, bstr0(*(char **)ka->arg));
return M_PROPERTY_OK;
}
}
}