+ def callback_need_track(self):
+ self.candidates = []
+ trks = []
+ target = self.plugin_conf.getint('track_to_add')
+ artists = self.player.list('artist', '( artist != "")')
+ random.shuffle(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)
+ trks = self.player.find_tracks(Artist(art))
+ if trks:
+ trk = random.choice(trks)
+ self.candidates.append(trk)
+ self.log.info('Random plugin chose (%s): %s', self.mode, trk)
+ if len(self.candidates) >= target:
+ break
+ return self.candidates