From 743466bf80ccba24d36461f7a358c98e4e93ee88 Mon Sep 17 00:00:00 2001 From: coderkun Date: Sat, 31 Jan 2015 13:03:59 +0100 Subject: [PATCH] check permissions for idle-command --- mcg.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mcg.py b/mcg.py index 97c52f2..3a46f2f 100644 --- a/mcg.py +++ b/mcg.py @@ -105,6 +105,8 @@ class Client(Base): PROTOCOL_COMPLETION = 'OK' # Protocol: error mark PROTOCOL_ERROR = 'ACK ' + # Protocol: error: permission + PROTOCOL_ERROR_PERMISSION = 4 # Signal: connection status SIGNAL_CONNECTION = 'connection' # Signal: status @@ -535,6 +537,8 @@ class Client(Base): self._write(command, args) return self._read() except MPDException as e: + if command == 'idle' and e.get_error() == Client.PROTOCOL_ERROR_PERMISSION: + self.disconnect() self._callback(Client.SIGNAL_ERROR, e)