From 0248e11c84a42df201feda6aa62062dc8c1df330 Mon Sep 17 00:00:00 2001 From: kaliko Date: Sat, 23 Jul 2016 10:36:17 +0200 Subject: [PATCH] Fixed client cache initialising, filters out empty strings --- doc/Changelog | 2 +- sima/client.py | 4 ++-- sima/plugins/internal/random.py | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/Changelog b/doc/Changelog index fb30f68..e539281 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,6 +1,6 @@ MPD_sima v0.14.2 - * + * Fixed MPD client cache (filters empty strings) -- kaliko jack UNRELEASED diff --git a/sima/client.py b/sima/client.py index 9c12f8b..236ab10 100644 --- a/sima/client.py +++ b/sima/client.py @@ -159,9 +159,9 @@ class PlayerClient(Player): self.log.info('Player: Initialising cache!') self._cache = {'artists': frozenset(), 'nombid_artists': frozenset(),} - self._cache['artists'] = frozenset(self._execute('list', ['artist'])) + self._cache['artists'] = frozenset(filter(None, self._execute('list', ['artist']))) if Artist.use_mbid: - self._cache['nombid_artists'] = frozenset(self._execute('list', ['artist', 'musicbrainz_artistid', ''])) + self._cache['nombid_artists'] = frozenset(filter(None, self._execute('list', ['artist', 'musicbrainz_artistid', '']))) @blacklist(track=True) def find_track(self, artist, title=None): diff --git a/sima/plugins/internal/random.py b/sima/plugins/internal/random.py index feca9d8..ec17e9a 100644 --- a/sima/plugins/internal/random.py +++ b/sima/plugins/internal/random.py @@ -47,6 +47,7 @@ class Random(Plugin): self.log.warning('Bad value for flavour, ' '"%s" not in ["pure", "sensible"]', self.mode) self.mode = 'pure' + self.log.debug('Random flavour: %s', self.mode) def get_played_artist(self,): """Constructs list of already played artists. -- 2.39.5