X-Git-Url: http://git.kaliko.me/?a=blobdiff_plain;f=sima%2Fclient.py;h=e171c0b1d6c1934d728470e649b06c104e486992;hb=73405cb1d2bbeac4bdd956b9746a1e8a3b7355d7;hp=0a7f754bfdb03dfeb47de52bb16647f1e0409714;hpb=2ec091faa883ec52e4e42536b1b23a672ecbc64a;p=mpd-sima.git diff --git a/sima/client.py b/sima/client.py index 0a7f754..e171c0b 100644 --- a/sima/client.py +++ b/sima/client.py @@ -159,11 +159,12 @@ class PlayerClient(Player): else: self.log.info('Player: Initialising cache!') self._cache = { - 'artists': None, - 'nombid_artists': None, + 'artists': frozenset(), + 'nombid_artists': frozenset(), } - self._cache['artists'] = frozenset(self._client.list('artist')) - self._cache['nombid_artists'] = frozenset(self._client.list('artist', 'musicbrainz_artistid', '')) + self._cache['artists'] = frozenset(self._execute('list', ['artist'])) + if Artist.use_mbid: + self._cache['nombid_artists'] = frozenset(self._execute('list', ['artist', 'musicbrainz_artistid', ''])) @blacklist(track=True) def find_track(self, artist, title=None): @@ -195,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 @@ -297,7 +298,7 @@ class PlayerClient(Player): arts = set([trk.artist for trk in album_trks]) if len(set(arts)) < 2: # TODO: better heuristic, use a ratio instead if album not in albums: - albums.append(Album(name=album, albumartist=artist)) + albums.append(Album(name=album, **kwalbart)) elif album and album not in albums: self.log.debug('"{0}" probably not an album of "{1}"'.format( album, artist) + '({0})'.format('/'.join(arts))) @@ -331,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):