X-Git-Url: https://git.kaliko.me/?a=blobdiff_plain;f=sima%2Fplugins%2Finternal%2Fgenre.py;h=1202f89716ca7e064289e1e796f8236c7bae8d7f;hb=a260ebea93f23d72aa6e0178744b0f64c469b7ba;hp=43aabf7b58dfca48aa6544b49776c768c18cb146;hpb=5cbf72d42c713c5a719fa407e6969f0a84fdfe21;p=mpd-sima.git diff --git a/sima/plugins/internal/genre.py b/sima/plugins/internal/genre.py index 43aabf7..1202f89 100644 --- a/sima/plugins/internal/genre.py +++ b/sima/plugins/internal/genre.py @@ -65,8 +65,8 @@ class Genre(AdvancedPlugin): def fetch_genres(self): """Fetches ,at most, nb-depth genre from history, and returns the nbgenres most present""" - depth = 10 # nb of genre to fetch from history for analysis - nbgenres = 2 # nb of genre to return + depth = 10 # nb of genre to fetch from history for analysis + nbgenres = 2 # nb of genre to return genres = [g[0] for g in self.sdb.fetch_genres_history(limit=depth)] if not genres: self.log.debug('No genre found in current track history') @@ -100,11 +100,13 @@ class Genre(AdvancedPlugin): for artist in artists: self.log.debug('looking for %s', artist) tracks = self.player.find_tracks(artist) - trk = self.filter_track(tracks) + if not tracks: + continue + trk = self.filter_track(tracks, candidates) if not trk: continue if queue_mode == 'track': - self.log.info('Genre plugin chose: {}'.format(trk)) + self.log.info('Genre plugin chose: %s', trk) candidates.append(trk) if len(candidates) == target: break