try catch loading spotify cache
This commit is contained in:
parent
6a6ec400db
commit
5ec49663e3
|
@ -338,11 +338,17 @@ class Spotify(Plugin):
|
||||||
self.settings = settings
|
self.settings = settings
|
||||||
|
|
||||||
def loadCache(self):
|
def loadCache(self):
|
||||||
|
cache = None
|
||||||
if (self.configFolder / 'cache.json').is_file():
|
if (self.configFolder / 'cache.json').is_file():
|
||||||
with open(self.configFolder / 'cache.json', 'r', encoding="utf-8") as f:
|
with open(self.configFolder / 'cache.json', 'r', encoding="utf-8") as f:
|
||||||
cache = json.load(f)
|
try:
|
||||||
else:
|
cache = json.load(f)
|
||||||
cache = {'tracks': {}, 'albums': {}}
|
except json.decoder.JSONDecodeError:
|
||||||
|
self.saveCache({'tracks': {}, 'albums': {}})
|
||||||
|
cache = None
|
||||||
|
except Exception:
|
||||||
|
cache = None
|
||||||
|
if not cache: cache = {'tracks': {}, 'albums': {}}
|
||||||
return cache
|
return cache
|
||||||
|
|
||||||
def saveCache(self, newCache):
|
def saveCache(self, newCache):
|
||||||
|
|
Loading…
Reference in New Issue