Added queue corrupted check when restoring it
This commit is contained in:
parent
a9a09c58e0
commit
ac1d3ba594
|
@ -475,7 +475,15 @@ class QueueManager:
|
||||||
if (configFolder / 'queue.json').is_file() and not len(self.queue):
|
if (configFolder / 'queue.json').is_file() and not len(self.queue):
|
||||||
if interface: interface.send('restoringQueue')
|
if interface: interface.send('restoringQueue')
|
||||||
with open(configFolder / 'queue.json', 'r') as f:
|
with open(configFolder / 'queue.json', 'r') as f:
|
||||||
qd = json.load(f)
|
try:
|
||||||
|
qd = json.load(f)
|
||||||
|
except json.decoder.JSONDecodeError:
|
||||||
|
logger.warn("Saved queue is corrupted, resetting it")
|
||||||
|
qd = {
|
||||||
|
'queue': [],
|
||||||
|
'queueComplete': [],
|
||||||
|
'queueList': {}
|
||||||
|
}
|
||||||
remove(configFolder / 'queue.json')
|
remove(configFolder / 'queue.json')
|
||||||
self.restoreQueue(qd['queue'], qd['queueComplete'], qd['queueList'], settings)
|
self.restoreQueue(qd['queue'], qd['queueComplete'], qd['queueList'], settings)
|
||||||
if interface:
|
if interface:
|
||||||
|
|
Loading…
Reference in New Issue