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:
Nitesh Sawant
2018-02-04 22:36:04 +05:30
parent 8550abd06a
commit 0e3249646f
2 changed files with 12 additions and 6 deletions

View File

@@ -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/)
[![Docker automated build](https://img.shields.io/docker/automated/jrottenberg/ffmpeg.svg)](https://hub.docker.com/r/ritiek/spotify-downloader)
[![Docker pulls](https://img.shields.io/docker/pulls/ritiek/spotify-downloader.svg)](https://hub.docker.com/r/ritiek/spotify-downloader)

View File

@@ -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