From: kaliko Date: Thu, 17 Jun 2021 11:48:57 +0000 (+0200) Subject: Fixed crash when player.find_tracks returns nothing X-Git-Tag: 0.18.0~30 X-Git-Url: https://git.kaliko.me/?a=commitdiff_plain;h=61d5b735d5967d10447eb1c7a2f9fe683d9736bd;p=mpd-sima.git Fixed crash when player.find_tracks returns nothing With the block list, player.find_tracks might return an empty list. --- diff --git a/sima/lib/webserv.py b/sima/lib/webserv.py index ca6b1f0..a0b899a 100644 --- a/sima/lib/webserv.py +++ b/sima/lib/webserv.py @@ -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 diff --git a/sima/plugins/internal/genre.py b/sima/plugins/internal/genre.py index 43aabf7..264d8ab 100644 --- a/sima/plugins/internal/genre.py +++ b/sima/plugins/internal/genre.py @@ -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': diff --git a/sima/plugins/internal/tags.py b/sima/plugins/internal/tags.py index 70d1a03..2e1ddac 100644 --- a/sima/plugins/internal/tags.py +++ b/sima/plugins/internal/tags.py @@ -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':