Skip to content

Commit

Permalink
Add API to set dict-valued properties
Browse files Browse the repository at this point in the history
  • Loading branch information
jaseg committed Jul 15, 2024
1 parent e1ae4f7 commit f4086d4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mpv.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit f4086d4

Please sign in to comment.