Browse Source

Update cache version

pull/165/head
Oliverpool 9 years ago
parent
commit
8516f3bfa0
  1. 7
      patacrep/songs/__init__.py

7
patacrep/songs/__init__.py

@ -80,7 +80,7 @@ class Song:
# Version format of cached song. Increment this number if we update # Version format of cached song. Increment this number if we update
# information stored in cache. # information stored in cache.
CACHE_VERSION = 2 CACHE_VERSION = 3
# List of attributes to cache # List of attributes to cache
cached_attributes = [ cached_attributes = [
@ -156,10 +156,7 @@ class Song:
"""If relevant, retrieve self from the cache.""" """If relevant, retrieve self from the cache."""
if self.use_cache and os.path.exists(self.cached_name): if self.use_cache and os.path.exists(self.cached_name):
try: try:
cached = pickle.load(open( cached = pickle.load(open(self.cached_name, 'rb',))
self.cached_name,
'rb',
))
if ( if (
cached['_filehash'] == self.filehash cached['_filehash'] == self.filehash
and cached['_version'] == self.CACHE_VERSION and cached['_version'] == self.CACHE_VERSION

Loading…
Cancel
Save