Compare commits

..

No commits in common. "ebff41e016f8c687f6cddf489a19da1f198b1c8e" and "1dc0d470dd943b17ace9c84921a6b3e66df44dc8" have entirely different histories.

1 changed files with 3 additions and 7 deletions

View File

@ -51,7 +51,7 @@ DEFAULTS = {
"localArtworkSize": 1400, "localArtworkSize": 1400,
"logErrors": True, "logErrors": True,
"logSearched": False, "logSearched": False,
"maxBitrate": TrackFormats.MP3_320, "maxBitrate": str(TrackFormats.MP3_320),
"overwriteFile": OverwriteOption.DONT_OVERWRITE, "overwriteFile": OverwriteOption.DONT_OVERWRITE,
"paddingSize": "0", "paddingSize": "0",
"padTracks": True, "padTracks": True,
@ -125,17 +125,13 @@ def load(configFolder=None):
except Exception: except Exception:
settings = deepcopy(DEFAULTS) settings = deepcopy(DEFAULTS)
if check(settings) > 0: if check(settings) > 0: save(settings, configFolder) # Check the settings and save them if something changed
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 type(settings[i_set] is type(DEFAULTS[i_set])): if not i_set in settings or not isinstance(settings[i_set], 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']: