X-Git-Url: http://git.kaliko.me/?a=blobdiff_plain;f=musicpd.py;h=aae85a5f5348e897760cfe4248668a8b58047c68;hb=a1d6fc6df18bca9a06232a77deecf241f48de92c;hp=3aa4cb071ab8c5b21049b6adaa1547492fb5de98;hpb=9e3563b9b6ef05e97e54d90d1149409a3669f0a5;p=python-musicpd.git diff --git a/musicpd.py b/musicpd.py index 3aa4cb0..aae85a5 100644 --- a/musicpd.py +++ b/musicpd.py @@ -204,14 +204,14 @@ class MPDClient: "rm": self._fetch_nothing, "save": self._fetch_nothing, # Database Commands - #"albumart": self._fetch_object, + "albumart": self._fetch_composite, "count": self._fetch_object, "find": self._fetch_songs, "findadd": self._fetch_nothing, "list": self._fetch_list, "listall": self._fetch_database, "listallinfo": self._fetch_database, - "listfiles": self._fetch_songs, + "listfiles": self._fetch_database, "lsinfo": self._fetch_database, "readcomments": self._fetch_object, "search": self._fetch_songs, @@ -502,6 +502,17 @@ class MPDClient: def _fetch_neighbors(self): return self._fetch_objects(["neighbor"]) + def _fetch_composite(self): + obj = {} + for key, value in self._read_pairs(): + key = key.lower() + obj[key] = value + if key == 'binary': + break + by = self._read_line() + obj['data'] = by.encode(errors='surrogateescape') + return obj + @iterator_wrapper def _fetch_command_list(self): return self._read_command_list() @@ -594,7 +605,7 @@ class MPDClient: self._sock = self._connect_unix(host) else: self._sock = self._connect_tcp(host, port) - self._rfile = self._sock.makefile("r", encoding='utf-8') + self._rfile = self._sock.makefile("r", encoding='utf-8', errors='surrogateescape') self._wfile = self._sock.makefile("w", encoding='utf-8') try: self._hello()