mirror of
https://github.com/KevinMidboe/spotify-downloader.git
synced 2025-10-29 09:50:16 +00:00
Config dir must exist before creating config file
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
language: python
|
||||
python:
|
||||
- "3.4"
|
||||
- "3.5"
|
||||
- "3.6"
|
||||
- "3.7"
|
||||
- "3.8"
|
||||
|
||||
2
setup.py
2
setup.py
@@ -64,8 +64,6 @@ setup(
|
||||
"License :: OSI Approved :: MIT License",
|
||||
"Programming Language :: Python",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3.4",
|
||||
"Programming Language :: Python :: 3.5",
|
||||
"Programming Language :: Python :: 3.6",
|
||||
"Programming Language :: Python :: 3.7",
|
||||
"Programming Language :: Python :: 3 :: Only",
|
||||
|
||||
@@ -2,5 +2,4 @@ from spotdl.command_line.__main__ import main
|
||||
|
||||
from spotdl.version import __version__
|
||||
from spotdl.command_line.lib import Spotdl
|
||||
from spotdl.track import Track
|
||||
|
||||
|
||||
@@ -54,21 +54,22 @@ def dump_config(config_file, config=DEFAULT_CONFIGURATION):
|
||||
def get_config(config_file):
|
||||
if os.path.isfile(config_file):
|
||||
config = read_config(config_file)
|
||||
else:
|
||||
config = DEFAULT_CONFIGURATION
|
||||
dump_config(config_file, config=DEFAULT_CONFIGURATION)
|
||||
return config
|
||||
|
||||
logger.info("Writing default configuration to {0}.".format(config_file))
|
||||
config_dir = os.path.dirname(config_file)
|
||||
os.makedirs(config_dir, exist_ok=True)
|
||||
dump_config(config_file, config=DEFAULT_CONFIGURATION)
|
||||
|
||||
for line in yaml.dump(
|
||||
DEFAULT_CONFIGURATION["spotify-downloader"], default_flow_style=False
|
||||
).split("\n"):
|
||||
if line.strip():
|
||||
logger.info(line.strip())
|
||||
logger.info(
|
||||
"Please note that command line arguments have higher priority "
|
||||
"than their equivalents in the configuration file."
|
||||
)
|
||||
logger.info("Writing default configuration to {0}.".format(config_file))
|
||||
|
||||
return config
|
||||
for line in yaml.dump(
|
||||
DEFAULT_CONFIGURATION["spotify-downloader"], default_flow_style=False
|
||||
).split("\n"):
|
||||
if line.strip():
|
||||
logger.info(line.strip())
|
||||
logger.info(
|
||||
"Please note that command line arguments have higher priority "
|
||||
"than their equivalents in the configuration file."
|
||||
)
|
||||
return DEFAULT_CONFIGURATION
|
||||
|
||||
|
||||
Reference in New Issue
Block a user