From 2fee52f28cf41fe5ee4a26d1444c4675180ad904 Mon Sep 17 00:00:00 2001 From: Krateng Date: Thu, 28 Mar 2019 18:08:04 +0100 Subject: [PATCH] Fixed rentention of cache age --- utilities.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/utilities.py b/utilities.py index a7213f8..6adae04 100644 --- a/utilities.py +++ b/utilities.py @@ -294,7 +294,7 @@ def track_from_cache(artists,title): nowday = datetime.date.today().toordinal() cacheday = cachedTracksDays[(frozenset(artists),title)] - if nowday - cacheday > retain: + if (nowday - cacheday) > retain: # fetch the new image in the background, but still return the old one for one last time log("Expired cache for " + "/".join(artists) + " - " + title) del cachedTracks[(frozenset(artists),title)] @@ -321,7 +321,7 @@ def artist_from_cache(artist): nowday = datetime.date.today().toordinal() cacheday = cachedArtistsDays[artist] - if nowday - cacheday > retain: + if (nowday - cacheday) > retain: # fetch the new image in the background, but still return the old one for one last time log("Expired cache for " + artist) del cachedArtists[artist] @@ -344,7 +344,7 @@ def loadCache(): try: ob = pickle.loads(fl.read()) - global cachedTracks, cachedArtists + global cachedTracks, cachedArtists, cachedTracksDays, cachedArtistsDays cachedTracks, cachedArtists, cachedTracksDays, cachedArtistsDays = ob["tracks"],ob["artists"],ob["tracks_days"],ob["artists_days"] #(cachedTracks, cachedArtists) = ob finally: