summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2022-04-17 22:49:20 +0200
committerjaseg <git@jaseg.de>2022-04-17 22:49:20 +0200
commite8c8736a1a0af284f97f7d43a92aaea6735e8a54 (patch)
tree89b9e2885e47ffc1b72aef8e7eb8c441b044b5b9
parent2b3249a73ddf23a4285538dcf1dbe4241374de70 (diff)
downloadpython-mpv-e8c8736a1a0af284f97f7d43a92aaea6735e8a54.tar.gz
python-mpv-e8c8736a1a0af284f97f7d43a92aaea6735e8a54.tar.bz2
python-mpv-e8c8736a1a0af284f97f7d43a92aaea6735e8a54.zip
Default to node_command and rename old command to string_command
-rw-r--r--mpv.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/mpv.py b/mpv.py
index fd61674..7ffb198 100644
--- a/mpv.py
+++ b/mpv.py
@@ -532,7 +532,7 @@ _mpv_create = backend.mpv_create
_handle_func('mpv_create_client', [c_char_p], MpvHandle, notnull_errcheck)
_handle_func('mpv_client_name', [], c_char_p, errcheck=None)
_handle_func('mpv_initialize', [], c_int, ec_errcheck)
-_handle_func('mpv_destroy', [], None, errcheck=None)
+_handle_func('mpv_destroy', [], None, errcheck=None)
_handle_func('mpv_terminate_destroy', [], None, errcheck=None)
_handle_func('mpv_load_config_file', [c_char_p], c_int, ec_errcheck)
_handle_func('mpv_get_time_us', [], c_ulonglong, errcheck=None)
@@ -1070,13 +1070,16 @@ class MPV(object):
"""
_mpv_request_log_messages(self._event_handle, level.encode('utf-8'))
- def command(self, name, *args):
+ def string_command(self, name, *args):
"""Execute a raw command."""
args = [name.encode('utf-8')] + [ (arg if type(arg) is bytes else str(arg).encode('utf-8'))
for arg in args if arg is not None ] + [None]
_mpv_command(self.handle, (c_char_p*len(args))(*args))
def node_command(self, name, *args, decoder=strict_decoder):
+ self.command(name, *args, decoder=decoder)
+
+ def command(self, name, *args, decoder=strict_decoder):
_1, _2, _3, pointer = _make_node_str_list([name, *args])
out = cast(create_string_buffer(sizeof(MpvNode)), POINTER(MpvNode))
ppointer = cast(pointer, POINTER(MpvNode))