From 61d5b735d5967d10447eb1c7a2f9fe683d9736bd Mon Sep 17 00:00:00 2001 From: kaliko Date: Thu, 17 Jun 2021 13:48:57 +0200 Subject: [PATCH] Fixed crash when player.find_tracks returns nothing With the block list, player.find_tracks might return an empty list. --- sima/lib/webserv.py | 2 ++ sima/plugins/internal/genre.py | 4 +++- sima/plugins/internal/tags.py | 4 +++- 3 files changed, 8 insertions(+), 2 deletions(-) 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': -- 2.39.5