From: kaliko Date: Sun, 8 Dec 2013 15:49:26 +0000 (+0100) Subject: Fixed a minor cache issue X-Git-Tag: mpd-sima/0.12.0pr2~13 X-Git-Url: https://git.kaliko.me/?a=commitdiff_plain;h=9d52bca547a781f264dcb8af782dd0beefb57b75;p=mpd-sima.git Fixed a minor cache issue --- 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: