From fb25d53c7216d90d2ccc55d443017715d73246fc Mon Sep 17 00:00:00 2001 From: kaliko Date: Fri, 5 May 2017 15:43:49 +0200 Subject: [PATCH] Honors artist blacklisting in Random plugin (Closes #14) --- doc/Changelog | 2 +- sima/client.py | 2 +- sima/plugins/internal/random.py | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/Changelog b/doc/Changelog index 974bdb4..9febe7c 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,6 +1,6 @@ MPD_sima v0.14.4 - * … + * Fixed blacklisting for Random plugin (Closes #14) -- kaliko jack UNRELEASED diff --git a/sima/client.py b/sima/client.py index 236ab10..525f268 100644 --- a/sima/client.py +++ b/sima/client.py @@ -62,7 +62,7 @@ def bl_artist(func): names = list() for art in result.names: if cls.database.get_bl_artist(art, add_not=True): - cls.log.debug('Blacklisted "{0}"'.format(art)) + cls.log.debug('Blacklisted "%s"', art) continue names.append(art) if not names: diff --git a/sima/plugins/internal/random.py b/sima/plugins/internal/random.py index ec17e9a..c678950 100644 --- a/sima/plugins/internal/random.py +++ b/sima/plugins/internal/random.py @@ -82,6 +82,9 @@ class Random(Plugin): played_art = self.get_played_artist() while artists: art = random.choice(artists) + if self.daemon.sdb.get_bl_artist(art, add_not=True): + self.log.debug('Random: Blacklisted "%s"', art) + continue if art not in played_art: break artists.pop(art) -- 2.39.5