mirror of
https://github.com/KevinMidboe/spotify-downloader.git
synced 2025-10-29 18:00:15 +00:00
Made Changes as per comments on PR
removed the unnecessary comma and space at the end! put the closing bracket on the previous line, as it's done with all the other parser.add_argument calls. remove the pass - it's completely unneccesary.
This commit is contained in:
@@ -140,6 +140,8 @@ optional arguments:
|
||||
(default: False)
|
||||
-ll {INFO,WARNING,ERROR,DEBUG}, --log-level {INFO,WARNING,ERROR,DEBUG}
|
||||
set log verbosity (default: INFO)
|
||||
-c CONFIG_FILE_PATH --config CONFIG_FILE_PATH
|
||||
path to custom config.yml file
|
||||
```
|
||||
|
||||
#### Download by Name
|
||||
@@ -261,6 +263,11 @@ to override any default options.
|
||||
|
||||
Also note that config options are overridden by command-line arguments.
|
||||
|
||||
#### Specify the Custom Config File Path
|
||||
|
||||
If you want to use custom `config.yml` instead of default one, you can use `-c`/`--config` option.
|
||||
E.g. `$ python3 spotdl.py -s "adele hello" -c "/home/user/customConfig.yml"`
|
||||
|
||||
## [Docker Image](https://hub.docker.com/r/ritiek/spotify-downloader/)
|
||||
[](https://hub.docker.com/r/ritiek/spotify-downloader)
|
||||
[](https://hub.docker.com/r/ritiek/spotify-downloader)
|
||||
|
||||
@@ -40,7 +40,6 @@ def merge(default, config):
|
||||
merged.update(config)
|
||||
return merged
|
||||
|
||||
|
||||
def get_config(config_file):
|
||||
try:
|
||||
with open(config_file, 'r') as ymlfile:
|
||||
@@ -53,7 +52,7 @@ def get_config(config_file):
|
||||
return cfg['spotify-downloader']
|
||||
|
||||
|
||||
def override_config(config_file, parser, raw_args=None, ):
|
||||
def override_config(config_file, parser, raw_args=None):
|
||||
""" Override default dict with config dict passed as comamnd line argument. """
|
||||
config_file = os.path.realpath(config_file)
|
||||
config = merge(default_conf['spotify-downloader'], get_config(config_file))
|
||||
@@ -152,13 +151,13 @@ def get_arguments(raw_args=None, to_group=True, to_merge=True):
|
||||
help='set log verbosity')
|
||||
parser.add_argument(
|
||||
'-c', '--config', default=None,
|
||||
help='Replace with custom config file'
|
||||
)
|
||||
help='Replace with custom config.yml file')
|
||||
|
||||
parsed = parser.parse_args(raw_args)
|
||||
parsed.log_level = log_leveller(parsed.log_level)
|
||||
|
||||
if parsed.config is not None and to_merge:
|
||||
parsed = override_config(parsed.config,parser)
|
||||
pass
|
||||
|
||||
parsed.log_level = log_leveller(parsed.log_level)
|
||||
|
||||
return parsed
|
||||
|
||||
Reference in New Issue
Block a user