]> kaliko git repositories - mpd-sima.git/blobdiff - sima/plugins/internal/genre.py
Clean some linter warnings and errors
[mpd-sima.git] / sima / plugins / internal / genre.py
index 43aabf7b58dfca48aa6544b49776c768c18cb146..713ee35eaa37fee3210e71704345149b9f3c111f 100644 (file)
@@ -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,7 +100,9 @@ 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':