]> kaliko git repositories - mpd-sima.git/commitdiff
Fixed crash when player.find_tracks returns nothing
authorkaliko <kaliko@azylum.org>
Thu, 17 Jun 2021 11:48:57 +0000 (13:48 +0200)
committerkaliko <kaliko@azylum.org>
Thu, 17 Jun 2021 11:48:57 +0000 (13:48 +0200)
With the block list, player.find_tracks might return an empty list.

sima/lib/webserv.py
sima/plugins/internal/genre.py
sima/plugins/internal/tags.py

index ca6b1f095b9b2d6499c9a384ca73218a0f348338..a0b899a3f624f82fdbc2f1b45f9e956574b82d9b 100644 (file)
@@ -259,6 +259,8 @@ class WebService(AdvancedPlugin):
                 continue
             nb_album_add += 1
             candidates = self.player.find_tracks(album)
+            if not candidates:
+                continue
             if self.plugin_conf.getboolean('shuffle_album'):
                 random.shuffle(candidates)
             # this allows to select a maximum number of track from the album
index 43aabf7b58dfca48aa6544b49776c768c18cb146..264d8abfba25e79c5c17b9e7ee30911ca822fa80 100644 (file)
@@ -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':
index 70d1a03e06609aaa774e94ade588ab98717d8cca..2e1ddac2dcee7ad97cf24b1de8bdebc09d50fe28 100644 (file)
@@ -137,7 +137,9 @@ class Tags(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':