From: kaliko Date: Sat, 8 Feb 2014 16:27:20 +0000 (+0100) Subject: Intercept missing artist in plugins' callback X-Git-Tag: mpd-sima/0.12.0pr3 X-Git-Url: https://git.kaliko.me/?a=commitdiff_plain;ds=sidebyside;h=cdb998d12265ec4e1f64c87cff22a8657e2a93ea;p=mpd-sima.git Intercept missing artist in plugins' callback --- 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