From f4086d4bb44603dcbaac51a162b280f760cbde2c Mon Sep 17 00:00:00 2001 From: jaseg Date: Mon, 15 Jul 2024 14:52:59 +0200 Subject: [PATCH] Add API to set dict-valued properties --- mpv.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mpv.py b/mpv.py index 8941aed..94eeb85 100644 --- a/mpv.py +++ b/mpv.py @@ -2064,7 +2064,10 @@ def _get_property(self, name, decoder=strict_decoder, fmt=MpvFormat.NODE): def _set_property(self, name, value): self.check_core_alive() ename = name.encode('utf-8') - if isinstance(value, (list, set, dict)): + if isinstance(value, dict): + _1, _2, _3, pointer = _make_node_str_map(value) + _mpv_set_property(self.handle, ename, MpvFormat.NODE, pointer) + elif isinstance(value, (list, set)): _1, _2, _3, pointer = _make_node_str_list(value) _mpv_set_property(self.handle, ename, MpvFormat.NODE, pointer) else: