return None
names = list()
for art in result.names:
- if cls.database.get_bl_artist(art, add_not=True):
- cls.log.debug('Blacklisted "%s"', art)
+ artist = Artist(name=art, mbid=result.mbid)
+ if cls.database.get_bl_artist(artist, add=False):
+ cls.log.debug('Artist "%s" in blocklist!', artist)
continue
names.append(art)
if not names:
# / decorators
-def blacklist(artist=False, album=False, track=False):
+def blocklist(album=False, track=False):
# pylint: disable=C0111,W0212
field = (album, track)
if track and cls.database.get_bl_album(elem, add=False):
# filter album as well in track mode
# (artist have already been)
- cls.log.debug('Blacklisted alb. "%s"', elem)
+ cls.log.debug('Album "%s" in blocklist', elem)
continue
results.append(elem)
return results
return artist
return None
- @blacklist(track=True)
+ @blocklist(track=True)
def search_track(self, artist, title):
"""Fuzzy search of title by an artist
"""
mtitle, title, leven)
return tracks
- @blacklist(album=True)
+ @blocklist(album=True)
def search_albums(self, artist):
"""Find potential albums for "artist"
self.candidates = []
def get_played_artist(self,):
- """Constructs list of already played artists.
- """
+ """Constructs list of already played artists."""
duration = self.main_conf.getint('sima', 'history_duration')
- tracks_from_db = self.sdb.get_history(duration=duration)
- artists = {tr[0] for tr in tracks_from_db}
+ artists = self.sdb.fetch_artists_history(duration=duration)
return artists
def filtered_artist(self, artist):
If sensible random is set:
* not in recent history
- * not blacklisted
+ * not in blocklist
"""
if self.mode == 'sensible':
- if self.sdb.get_bl_artist(artist, add_not=True):
+ if self.sdb.get_bl_artist(Artist(artist), add=False):
self.log.debug('Random plugin: Blacklisted "%s"', artist)
return True
if artist in self.get_played_artist():
target = self.plugin_conf.getint('track_to_add')
artists = self.player.list('artist', '( artist != "")')
random.shuffle(artists)
- for art in artists:
+ for art in artists: # artists is a list of strings here
if self.filtered_artist(art):
continue
self.log.debug('Random art: %s', art)