From 2cddb244c6813cecf5bc24ce95d84e5136ea3f7e Mon Sep 17 00:00:00 2001 From: kaliko Date: Tue, 3 Feb 2015 18:42:31 +0100 Subject: [PATCH] More robust MPD client --- doc/Changelog | 1 + sima/client.py | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/doc/Changelog b/doc/Changelog index 1582b89..f9466e1 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -3,6 +3,7 @@ MPD_sima v0.14.0 * Fixed top track mode * Fixed default conf file name (back to mpd_sima.cfg) * Cleanup code (removed users similarities) + * More robust MPD client -- kaliko jack UNRELEASED diff --git a/sima/client.py b/sima/client.py index 63c2632..f64277e 100644 --- a/sima/client.py +++ b/sima/client.py @@ -162,9 +162,9 @@ class PlayerClient(Player): 'artists': None, 'nombid_artists': None, } - self._cache['artists'] = frozenset(self._client.list('artist')) + self._cache['artists'] = frozenset(self._execute('list', ['artist'])) if Artist.use_mbid: - self._cache['nombid_artists'] = frozenset(self._client.list('artist', 'musicbrainz_artistid', '')) + self._cache['nombid_artists'] = frozenset(self._execute('list', ['artist', 'musicbrainz_artistid', ''])) @blacklist(track=True) def find_track(self, artist, title=None): @@ -196,7 +196,7 @@ class PlayerClient(Player): found = False if artist.mbid: # look for exact search w/ musicbrainz_artistid - exact_m = self._client.list('artist', 'musicbrainz_artistid', artist.mbid) + exact_m = self._execute('list', ['artist', 'musicbrainz_artistid', artist.mbid]) if exact_m: [artist.add_alias(name) for name in exact_m] found = True @@ -332,7 +332,7 @@ class PlayerClient(Player): def add(self, track): """Overriding MPD's add method to accept add signature with a Track object""" - self._client.add(track.file) + self._execute('add', [track.file]) @property def artists(self): -- 2.39.5