From 418a891bc69e8729f327e0c9fc38e45786ade65d Mon Sep 17 00:00:00 2001 From: kaliko Date: Sun, 8 Feb 2015 18:59:59 +0100 Subject: [PATCH] Fixed http caching for Lastfm. --- doc/Changelog | 1 + sima/lib/cache.py | 2 +- sima/plugins/internal/lastfm.py | 5 ++--- 3 files changed, 4 insertions(+), 4 deletions(-) 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 -- 2.39.2