self.mode = self.plugin_conf.get('flavour', None)
if self.mode not in ['pure', 'sensible']:
self.log.warning('Bad value for flavour, '
- '"{}" not in ["pure", "sensible"]'.format(self.mode))
+ '"%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.
duration = self.daemon.config.getint('sima', 'history_duration')
tracks_from_db = self.daemon.sdb.get_history(duration=duration)
# Construct Track() objects list from database history
- artists = [tr[-1] for tr in tracks_from_db]
+ artists = [tr[0] for tr in tracks_from_db]
return set(artists)
def callback_need_track(self):
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)
+ artists.remove(art)
elif self.mode == 'pure':
art = random.choice(artists)
if art is None: