]> kaliko git repositories - mpd-sima.git/commitdiff
Intercept missing artist in plugins' callback mpd-sima/0.12.0pr3
authorkaliko <efrim@azylum.org>
Sat, 8 Feb 2014 16:27:20 +0000 (17:27 +0100)
committerkaliko <efrim@azylum.org>
Sat, 8 Feb 2014 16:27:20 +0000 (17:27 +0100)
sima/lib/simafm.py
sima/plugins/internal/echonest.py
sima/plugins/internal/lastfm.py

index 95a4fee42439381d0398b65c1870f5565e6361f4..d01567ea05435ea03c938fba99e64dabaccd3342 100644 (file)
@@ -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
         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)
             return
         try:
             self._fetch_ech(payload)
index b2971db4cbe1eb578ef95d31416cbcc7b338f3e9..4cd2f1d69b41171feaa728dfc7d469431133d6a3 100644 (file)
@@ -336,7 +336,11 @@ class EchoNest(Plugin):
     def callback_need_track(self):
         self._cleanup_cache()
         if not self.player.current:
     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
             return None
         self.queue_mode()
         candidates = self.to_add
index 3bae05eaf7761d6d5553f4c63b8a44103ee4c346..0cb3532477b7c59ec0b97d851e9f79dd1598993c 100644 (file)
@@ -342,7 +342,11 @@ class Lastfm(Plugin):
     def callback_need_track(self):
         self._cleanup_cache()
         if not self.player.current:
     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
             return None
         self.queue_mode()
         candidates = self.to_add