X-Git-Url: http://git.kaliko.me/?a=blobdiff_plain;f=musicpd.py;h=d4d1974e146d5b5da5bc79c353492e7c8817d1ac;hb=d6599ddc82b7979e040bf7acd6a0fee2ff90c508;hp=f63857c4e8c931097f2a1d6e457ced94f96dd988;hpb=7cb6ba6bfc1dfae2be3ef0047dfeaabc87b81df7;p=python-musicpd.git diff --git a/musicpd.py b/musicpd.py index f63857c..d4d1974 100644 --- a/musicpd.py +++ b/musicpd.py @@ -28,7 +28,7 @@ HELLO_PREFIX = "OK MPD " ERROR_PREFIX = "ACK " SUCCESS = "OK" NEXT = "list_OK" -VERSION = '0.4.5' +VERSION = '0.6.0' #: seconds before a tcp connection attempt times out CONNECTION_TIMEOUT = 5 @@ -225,6 +225,7 @@ class MPDClient: # Database Commands "albumart": self._fetch_composite, "count": self._fetch_object, + "getfingerprint": self._fetch_object, "find": self._fetch_songs, "findadd": self._fetch_nothing, "list": self._fetch_list, @@ -233,6 +234,7 @@ class MPDClient: "listfiles": self._fetch_database, "lsinfo": self._fetch_database, "readcomments": self._fetch_object, + "readpicture": self._fetch_composite, "search": self._fetch_songs, "searchadd": self._fetch_nothing, "searchaddpl": self._fetch_nothing, @@ -263,6 +265,8 @@ class MPDClient: "partition": self._fetch_nothing, "listpartitions": self._fetch_list, "newpartition": self._fetch_nothing, + "delpartition": self._fetch_nothing, + "moveoutput": self._fetch_nothing, # Audio Output Commands "disableoutput": self._fetch_nothing, "enableoutput": self._fetch_nothing, @@ -393,7 +397,7 @@ class MPDClient: def _read_binary(self, amount): chunk = bytearray() while amount > 0: - result = self._rbfile.recv(amount) + result = self._rbfile.read(amount) if len(result) == 0: self.disconnect() raise ConnectionError("Connection lost while reading binary content") @@ -542,6 +546,10 @@ class MPDClient: obj[key] = value if key == 'binary': break + if not obj: + # If the song file was recognized, but there is no picture, the + # response is successful, but is otherwise empty. + return obj amount = int(obj['binary']) try: obj['data'] = self._read_binary(amount)