From: kaliko Date: Sun, 8 Feb 2015 17:59:59 +0000 (+0100) Subject: Fixed http caching for Lastfm. X-Git-Tag: 0.14.0~19 X-Git-Url: https://git.kaliko.me/?a=commitdiff_plain;h=418a891bc69e8729f327e0c9fc38e45786ade65d;p=mpd-sima.git Fixed http caching for Lastfm. --- diff --git a/doc/Changelog b/doc/Changelog index bbdbf17..2a1bbf0 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -4,6 +4,7 @@ MPD_sima v0.14.0 * More robust MPD client * Fixed top track mode * Fixed default conf file name (back to mpd_sima.cfg) + * Fixed http cache for lastFM * Cleanup code (removed users similarities) -- kaliko jack UNRELEASED diff --git a/sima/lib/cache.py b/sima/lib/cache.py index e16ca0e..9603c8b 100644 --- a/sima/lib/cache.py +++ b/sima/lib/cache.py @@ -73,7 +73,7 @@ class FileCache: self.forever = forever if not os.path.isdir(self.directory): - os.makedirs(self.directory) + os.makedirs(self.directory, mode=0o755) def encode(self, val): return md5(val.encode('utf-8')).hexdigest() diff --git a/sima/plugins/internal/lastfm.py b/sima/plugins/internal/lastfm.py index f6008dc..66ced04 100644 --- a/sima/plugins/internal/lastfm.py +++ b/sima/plugins/internal/lastfm.py @@ -38,14 +38,13 @@ class Lastfm(WebService): def __init__(self, daemon): WebService.__init__(self, daemon) - self.ws = SimaFM() # Set persitent cache vardir = daemon.config['sima']['var_dir'] persitent_cache = daemon.config.getboolean('lastfm', 'cache') if persitent_cache: + self.log.debug('Persistant cache enabled in {}'.format(join(vardir, 'http', 'LastFM'))) SimaFM.cache = FileCache(join(vardir, 'http', 'LastFM')) - else: - SimaFM.cache = DictCache() + self.ws = SimaFM() # VIM MODLINE