]> kaliko git repositories - mpd-sima.git/blobdiff - sima/plugins/internal/echonest.py
Intercept missing artist in plugins' callback
[mpd-sima.git] / sima / plugins / internal / echonest.py
index d5a5122d8c2c7a12d709fc8e5ac68a3b1a856a2c..4cd2f1d69b41171feaa728dfc7d469431133d6a3 100644 (file)
@@ -180,6 +180,7 @@ class EchoNest(Plugin):
         as_artists = simaech.get_similar(artist=current)
         self.log.debug('Requesting EchoNest for "{0}"'.format(current))
         try:
+            # TODO: let's propagate Artist type
             [as_art.append(str(art)) for art in as_artists]
         except EchoNotFound as err:
             self.log.warning(err)
@@ -293,7 +294,7 @@ class EchoNest(Plugin):
             if not album_to_queue:
                 self.log.info('No album found for "%s"' % artist)
                 continue
-            self.log.info('last.fm album candidate: {0} - {1}'.format(
+            self.log.info('echonest album candidates: {0} - {1}'.format(
                            artist, album_to_queue))
             nb_album_add += 1
             self.to_add.extend(self.player.find_album(artist, album_to_queue))
@@ -335,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