Cleaned up settings.py
This commit is contained in:
parent
335a42ea83
commit
860d57c437
|
@ -94,10 +94,7 @@ DEFAULT_SETTINGS = {
|
||||||
class Settings:
|
class Settings:
|
||||||
def __init__(self, configFolder=None):
|
def __init__(self, configFolder=None):
|
||||||
self.settings = {}
|
self.settings = {}
|
||||||
self.configFolder = configFolder
|
self.configFolder = Path(configFolder or localpaths.getConfigFolder())
|
||||||
if not self.configFolder:
|
|
||||||
self.configFolder = localpaths.getConfigFolder()
|
|
||||||
self.configFolder = Path(self.configFolder)
|
|
||||||
|
|
||||||
# Create config folder if it doesn't exsist
|
# Create config folder if it doesn't exsist
|
||||||
makedirs(self.configFolder, exist_ok=True)
|
makedirs(self.configFolder, exist_ok=True)
|
||||||
|
@ -149,13 +146,13 @@ class Settings:
|
||||||
# Checks if the default settings have changed
|
# Checks if the default settings have changed
|
||||||
def settingsCheck(self):
|
def settingsCheck(self):
|
||||||
changes = 0
|
changes = 0
|
||||||
for x in DEFAULT_SETTINGS:
|
for set in DEFAULT_SETTINGS:
|
||||||
if not x in self.settings or type(self.settings[x]) != type(DEFAULT_SETTINGS[x]):
|
if not set in self.settings or type(self.settings[set]) != type(DEFAULT_SETTINGS[set]):
|
||||||
self.settings[x] = DEFAULT_SETTINGS[x]
|
self.settings[set] = DEFAULT_SETTINGS[set]
|
||||||
changes += 1
|
changes += 1
|
||||||
for x in DEFAULT_SETTINGS['tags']:
|
for set in DEFAULT_SETTINGS['tags']:
|
||||||
if not x in self.settings['tags'] or type(self.settings['tags'][x]) != type(DEFAULT_SETTINGS['tags'][x]):
|
if not set in self.settings['tags'] or type(self.settings['tags'][set]) != type(DEFAULT_SETTINGS['tags'][set]):
|
||||||
self.settings['tags'][x] = DEFAULT_SETTINGS['tags'][x]
|
self.settings['tags'][set] = DEFAULT_SETTINGS['tags'][set]
|
||||||
changes += 1
|
changes += 1
|
||||||
if self.settings['downloadLocation'] == "":
|
if self.settings['downloadLocation'] == "":
|
||||||
self.settings['downloadLocation'] = str(localpaths.getHomeFolder() / 'deemix Music')
|
self.settings['downloadLocation'] = str(localpaths.getHomeFolder() / 'deemix Music')
|
||||||
|
|
Loading…
Reference in New Issue