Moved local outside of settings
This commit is contained in:
parent
42842b07b8
commit
3f8d4d5ae9
|
@ -11,7 +11,10 @@ from os.path import isfile
|
||||||
@click.option('-l', '--local', is_flag=True, help='Downloads in a local folder insted of using the default')
|
@click.option('-l', '--local', is_flag=True, help='Downloads in a local folder insted of using the default')
|
||||||
@click.argument('url', nargs=-1, required=True)
|
@click.argument('url', nargs=-1, required=True)
|
||||||
def download(bitrate, local, url):
|
def download(bitrate, local, url):
|
||||||
settings = initSettings(local)
|
settings = initSettings()
|
||||||
|
if local:
|
||||||
|
settings['downloadLocation'] = randomString(12)
|
||||||
|
click.echo("Using a local download folder: "+settings['downloadLocation'])
|
||||||
app.login()
|
app.login()
|
||||||
url = list(url)
|
url = list(url)
|
||||||
if isfile(url[0]):
|
if isfile(url[0]):
|
||||||
|
|
|
@ -18,7 +18,7 @@ settings = {}
|
||||||
defaultSettings = {}
|
defaultSettings = {}
|
||||||
configDir = ""
|
configDir = ""
|
||||||
|
|
||||||
def initSettings(localFolder = False, configFolder = None):
|
def initSettings(configFolder = None):
|
||||||
global settings
|
global settings
|
||||||
global defaultSettings
|
global defaultSettings
|
||||||
global configDir
|
global configDir
|
||||||
|
@ -37,10 +37,7 @@ def initSettings(localFolder = False, configFolder = None):
|
||||||
settings = json.load(configFile)
|
settings = json.load(configFile)
|
||||||
settingsCheck()
|
settingsCheck()
|
||||||
|
|
||||||
if localFolder:
|
if settings['downloadLocation'] == "":
|
||||||
settings['downloadLocation'] = randomString(12)
|
|
||||||
logger.info("Using a local download folder: "+settings['downloadLocation'])
|
|
||||||
elif settings['downloadLocation'] == "":
|
|
||||||
settings['downloadLocation'] = path.join(localpaths.getHomeFolder(), 'deemix Music')
|
settings['downloadLocation'] = path.join(localpaths.getHomeFolder(), 'deemix Music')
|
||||||
saveSettings(settings)
|
saveSettings(settings)
|
||||||
makedirs(settings['downloadLocation'], exist_ok=True)
|
makedirs(settings['downloadLocation'], exist_ok=True)
|
||||||
|
|
Loading…
Reference in New Issue