From cdb998d12265ec4e1f64c87cff22a8657e2a93ea Mon Sep 17 00:00:00 2001 From: kaliko Date: Sat, 8 Feb 2014 17:27:20 +0100 Subject: [PATCH] Intercept missing artist in plugins' callback --- sima/lib/simafm.py | 1 - sima/plugins/internal/echonest.py | 6 +++++- sima/plugins/internal/lastfm.py | 6 +++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/sima/lib/simafm.py b/sima/lib/simafm.py index 95a4fee..d01567e 100644 --- a/sima/lib/simafm.py +++ b/sima/lib/simafm.py @@ -74,7 +74,6 @@ class SimaFM(): url = Request('GET', self._url, params=payload,).prepare().url if url in SimaFM.cache: self.current_element = SimaFM.cache.get(url).elem - print('is cached') return try: self._fetch_ech(payload) diff --git a/sima/plugins/internal/echonest.py b/sima/plugins/internal/echonest.py index b2971db..4cd2f1d 100644 --- a/sima/plugins/internal/echonest.py +++ b/sima/plugins/internal/echonest.py @@ -336,7 +336,11 @@ class EchoNest(Plugin): def callback_need_track(self): self._cleanup_cache() if not self.player.current: - self.log.info('Not currently playing track, cannot queue') + self.log.info('No current track, cannot queue') + return None + if not self.player.current.artist: + self.log.warning('No artist set for the current track') + self.log.debug(repr(self.player.current)) return None self.queue_mode() candidates = self.to_add diff --git a/sima/plugins/internal/lastfm.py b/sima/plugins/internal/lastfm.py index 3bae05e..0cb3532 100644 --- a/sima/plugins/internal/lastfm.py +++ b/sima/plugins/internal/lastfm.py @@ -342,7 +342,11 @@ class Lastfm(Plugin): def callback_need_track(self): self._cleanup_cache() if not self.player.current: - self.log.info('Not currently playing track, cannot queue') + self.log.info('No current track, cannot queue') + return None + if not self.player.current.artist: + self.log.warning('No artist set for the current track') + self.log.debug(repr(self.player.current)) return None self.queue_mode() candidates = self.to_add -- 2.39.5