Add dataloss prevention message on db loading error

dev
Michael Kuperfish Steinberg 2023-01-20 13:20:05 +02:00
rodzic 522012110d
commit 4b2afa4ef0
1 zmienionych plików z 3 dodań i 0 usunięć

Wyświetl plik

@ -107,6 +107,9 @@ def save_globals_save_file():
console.log(f'Loaded {len(g_downloaded_songs)} songs & {len(g_downloaded_artist_covers)} artists')
except Exception as ex:
console.error(f'Failed to load globals save file! Exception: {ex}')
if os.path.exists(settings.GLOBALS_SAVE_FILE):
console.error(f'TO avoid data loss, SpotiFile will now exit.')
exit(1)
while g_keep_saving > 0:
with open(settings.GLOBALS_SAVE_FILE, 'w') as f:
g_downloaded_songs_json = json.dumps(g_downloaded_songs)