Compare commits

...

3 Commits

1 changed files with 7 additions and 3 deletions

View File

@ -51,7 +51,7 @@ DEFAULTS = {
"localArtworkSize": 1400, "localArtworkSize": 1400,
"logErrors": True, "logErrors": True,
"logSearched": False, "logSearched": False,
"maxBitrate": str(TrackFormats.MP3_320), "maxBitrate": TrackFormats.MP3_320,
"overwriteFile": OverwriteOption.DONT_OVERWRITE, "overwriteFile": OverwriteOption.DONT_OVERWRITE,
"paddingSize": "0", "paddingSize": "0",
"padTracks": True, "padTracks": True,
@ -125,13 +125,17 @@ def load(configFolder=None):
except Exception: except Exception:
settings = deepcopy(DEFAULTS) settings = deepcopy(DEFAULTS)
if check(settings) > 0: save(settings, configFolder) # Check the settings and save them if something changed if check(settings) > 0:
try:
save(settings, configFolder) # Check the settings and save them if something changed
except:
print(f"Error saving config file {configFile.name}, continuing without saving.")
return settings return settings
def check(settings): def check(settings):
changes = 0 changes = 0
for i_set in DEFAULTS: for i_set in DEFAULTS:
if not i_set in settings or not isinstance(settings[i_set], type(DEFAULTS[i_set])): if not i_set in settings or not type(settings[i_set] is type(DEFAULTS[i_set])):
settings[i_set] = DEFAULTS[i_set] settings[i_set] = DEFAULTS[i_set]
changes += 1 changes += 1
for i_set in DEFAULTS['tags']: for i_set in DEFAULTS['tags']: