From 9d52bca547a781f264dcb8af782dd0beefb57b75 Mon Sep 17 00:00:00 2001 From: kaliko Date: Sun, 8 Dec 2013 16:49:26 +0100 Subject: [PATCH] Fixed a minor cache issue --- sima/plugins/internal/lastfm.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sima/plugins/internal/lastfm.py b/sima/plugins/internal/lastfm.py index c5a772f..3c576a6 100644 --- a/sima/plugins/internal/lastfm.py +++ b/sima/plugins/internal/lastfm.py @@ -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: -- 2.39.5