From 8ccd47d82ec6c6a1344a62812a35842d88c5ae64 Mon Sep 17 00:00:00 2001 From: coderkun Date: Sun, 7 Aug 2016 21:08:03 +0200 Subject: [PATCH] add support for command lists https://www.musicpd.org/doc/protocol/command_lists.html --- mcg/client.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mcg/client.py b/mcg/client.py index c903802..395a56a 100644 --- a/mcg/client.py +++ b/mcg/client.py @@ -534,6 +534,15 @@ class Client(Base): 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): if args is not None and len(args) > 0: line = '{} "{}"\n'.format(command, '" "'.join(str(x).replace('"', '\\\"') for x in args))