mirror of
https://github.com/KevinMidboe/spotify-downloader.git
synced 2025-10-29 18:00:15 +00:00
First run config info (#273)
* Show default options and config path when running for the first time * Remove unnecessary global
This commit is contained in:
committed by
Ritiek Malhotra
parent
4eb4628128
commit
a1b4266d08
@@ -1,4 +1,6 @@
|
|||||||
from core import internals
|
from core import internals, const
|
||||||
|
|
||||||
|
log = const.log
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import yaml
|
import yaml
|
||||||
@@ -48,10 +50,17 @@ def get_config(config_file):
|
|||||||
with open(config_file, 'r') as ymlfile:
|
with open(config_file, 'r') as ymlfile:
|
||||||
cfg = yaml.load(ymlfile)
|
cfg = yaml.load(ymlfile)
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
|
log.info('Writing default configuration to {0}:'.format(config_file))
|
||||||
with open(config_file, 'w') as ymlfile:
|
with open(config_file, 'w') as ymlfile:
|
||||||
yaml.dump(default_conf, ymlfile, default_flow_style=False)
|
yaml.dump(default_conf, ymlfile, default_flow_style=False)
|
||||||
cfg = default_conf
|
cfg = default_conf
|
||||||
|
|
||||||
|
for line in yaml.dump(default_conf['spotify-downloader'], default_flow_style=False).split('\n'):
|
||||||
|
if line.strip():
|
||||||
|
log.info(line.strip())
|
||||||
|
log.info('Please note that command line arguments have higher priority '
|
||||||
|
'than their equivalents in the configuration file')
|
||||||
|
|
||||||
return cfg['spotify-downloader']
|
return cfg['spotify-downloader']
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user