]> kaliko git repositories - mpd-sima.git/commitdiff
Fixed a minor cache issue
authorkaliko <efrim@azylum.org>
Sun, 8 Dec 2013 15:49:26 +0000 (16:49 +0100)
committerkaliko <efrim@azylum.org>
Sun, 8 Dec 2013 15:49:26 +0000 (16:49 +0100)
sima/plugins/internal/lastfm.py

index c5a772f5b763552961854bda1787a90a9aad0867..3c576a60320d8de0e00e943fb41974737d5cdce2 100644 (file)
@@ -30,6 +30,7 @@ def cache(func):
             results = cls._cache.get('asearch').get(hashedlst)
         else:
             results = func(*args, **kwargs)
+            cls.log.debug('caching request')
             cls._cache.get('asearch').update({hashedlst:list(results)})
         random.shuffle(results)
         return results
@@ -244,6 +245,8 @@ class Lastfm(Plugin):
         for artist in extra_arts:
             self.log.debug('Looking for artist similar to "{0.artist}" as well'.format(artist))
             similar = self.lfm_similar_artists(artist=artist)
+            if not similar:
+                return ret_extra
             similar = sorted(similar, key=lambda sim: sim[1], reverse=True)
             ret_extra.extend(self.get_artists_from_player(similar))
             if current.artist in ret_extra: