add support for command lists
https://www.musicpd.org/doc/protocol/command_lists.html
This commit is contained in:
parent
6e06d6d06a
commit
8ccd47d82e
1 changed files with 9 additions and 0 deletions
|
|
@ -534,6 +534,15 @@ class Client(Base):
|
||||||
self._callback(Client.SIGNAL_ERROR, e)
|
self._callback(Client.SIGNAL_ERROR, e)
|
||||||
|
|
||||||
|
|
||||||
|
def _call_list(self, command, *args):
|
||||||
|
try:
|
||||||
|
self._write(command, args)
|
||||||
|
except MPDException as e:
|
||||||
|
if command == 'idle' and e.get_error() == Client.PROTOCOL_ERROR_PERMISSION:
|
||||||
|
self.disconnect()
|
||||||
|
self._callback(Client.SIGNAL_ERROR, e)
|
||||||
|
|
||||||
|
|
||||||
def _write(self, command, args=None):
|
def _write(self, command, args=None):
|
||||||
if args is not None and len(args) > 0:
|
if args is not None and len(args) > 0:
|
||||||
line = '{} "{}"\n'.format(command, '" "'.join(str(x).replace('"', '\\\"') for x in args))
|
line = '{} "{}"\n'.format(command, '" "'.join(str(x).replace('"', '\\\"') for x in args))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue