From 1e1a74f7f4046eaf2d09f383c32e4dd6587f7324 Mon Sep 17 00:00:00 2001 From: ritiek Date: Sun, 8 Apr 2018 16:17:15 +0530 Subject: [PATCH] Improve usage help --- README.md | 61 ++++++++++++++++++++++++++++---------------------- core/handle.py | 47 ++++++++++++++++++++++---------------- 2 files changed, 62 insertions(+), 46 deletions(-) diff --git a/README.md b/README.md index a7f937c..4b5f3fb 100755 --- a/README.md +++ b/README.md @@ -90,64 +90,71 @@ but make sure `$ python -V` gives you a `Python 3.x.x`! ``` usage: spotdl.py [-h] (-s SONG | -l LIST | -p PLAYLIST | -b ALBUM | -u USERNAME) - [-m] [-nm] [-a] [-f FOLDER] [--overwrite {force,skip,prompt}] - [-i {.webm,.m4a}] [-o OUTPUT_EXT] [-ff] [-sf] [-dm] [-d] - [-mo] [-ns] [-ll {INFO,WARNING,ERROR,DEBUG}] [-c CONFIG] + [-m] [-nm] [-a] [-f FOLDER] [--overwrite {prompt,force,skip}] + [-i {.m4a,.webm}] [-o OUTPUT_EXT] [-ff FILE_FORMAT] + [-sf SEARCH_FORMAT] [-dm] [-d] [-mo] [-ns] + [-ll {INFO,WARNING,ERROR,DEBUG}] [-c CONFIG] -Download and convert songs from Spotify, Youtube etc. +Download and convert tracks from Spotify, Youtube etc. optional arguments: -h, --help show this help message and exit - -s SONG, --song SONG download song by spotify link or name (default: None) - -l LIST, --list LIST download songs from a file (default: None) + -s SONG, --song SONG download track by spotify link or name (default: None) + -l LIST, --list LIST download tracks from a file (default: None) -p PLAYLIST, --playlist PLAYLIST - load songs from playlist URL into .txt + load tracks from playlist URL into .txt (default: None) -b ALBUM, --album ALBUM - load songs from album URL into .txt + load tracks from album URL into .txt (default: None) -u USERNAME, --username USERNAME - load songs from user's playlist into + load tracks from user's playlist into .txt (default: None) - -m, --manual choose the song to download manually (default: False) - -nm, --no-metadata do not embed metadata in songs (default: False) - -a, --avconv Use avconv for conversion otherwise set defaults to - ffmpeg (default: False) + -m, --manual choose the track to download manually from a list of + matching tracks (default: False) + -nm, --no-metadata do not embed metadata in tracks (default: False) + -a, --avconv use avconv for conversion (otherwise defaults to + ffmpeg) (default: False) -f FOLDER, --folder FOLDER - path to folder where files will be stored in (default: - Music) - --overwrite {force,skip,prompt} + path to folder where downloaded tracks will be stored + in (default: Music) + --overwrite {prompt,force,skip} change the overwrite policy (default: prompt) - -i {.webm,.m4a}, --input-ext {.webm,.m4a} - prefered input format .m4a or .webm (Opus) (default: + -i {.m4a,.webm}, --input-ext {.m4a,.webm} + preferred input format .m4a or .webm (Opus) (default: .m4a) -o OUTPUT_EXT, --output-ext OUTPUT_EXT - prefered output format .mp3, .m4a (AAC), .flac, etc. + preferred output format .mp3, .m4a (AAC), .flac, etc. (default: .mp3) - -ff, --file-format File format to save the downloaded song with, each tag - is surrounded by curly braces. Possible formats: + -ff FILE_FORMAT, --file-format FILE_FORMAT + file format to save the downloaded track with, each + tag is surrounded by curly braces. Possible formats: ['track_name', 'artist', 'album', 'album_artist', 'genre', 'disc_number', 'duration', 'year', 'original_date', 'track_number', 'total_tracks', 'isrc'] (default: {artist} - {track_name}) - -sf, --search-format Search format to search for on YouTube, each tag is + -sf SEARCH_FORMAT, --search-format SEARCH_FORMAT + search format to search for on YouTube, each tag is surrounded by curly braces. Possible formats: ['track_name', 'artist', 'album', 'album_artist', 'genre', 'disc_number', 'duration', 'year', 'original_date', 'track_number', 'total_tracks', 'isrc'] (default: {artist} - {track_name} lyrics) -dm, --download-only-metadata - download songs for which metadata is found (default: + download tracks only whose metadata is found (default: False) - -d, --dry-run Show only track title and YouTube URL (default: False) + -d, --dry-run show only track title and YouTube URL, and then skip + to the next track (if any) (default: False) -mo, --music-videos-only - Search only for music on Youtube (default: False) - -ns, --no-spaces Replace spaces with underscores in file names + search only for music videos on Youtube (works only + when YouTube API key is set (default: False) + -ns, --no-spaces replace spaces with underscores in file names (default: False) -ll {INFO,WARNING,ERROR,DEBUG}, --log-level {INFO,WARNING,ERROR,DEBUG} set log verbosity (default: INFO) -c CONFIG, --config CONFIG - Replace with custom config.yml file (default: None) + path to config.yml file (otherwise load it from same + directory as spotdl.py) (default: None) ``` #### Download by Name diff --git a/core/handle.py b/core/handle.py index c777d76..c7ca5d3 100644 --- a/core/handle.py +++ b/core/handle.py @@ -81,7 +81,7 @@ def override_config(config_file, parser, raw_args=None): def get_arguments(raw_args=None, to_group=True, to_merge=True): parser = argparse.ArgumentParser( - description='Download and convert songs from Spotify, Youtube etc.', + description='Download and convert tracks from Spotify, Youtube etc.', formatter_class=argparse.ArgumentDefaultsHelpFormatter) if to_merge: @@ -94,66 +94,74 @@ def get_arguments(raw_args=None, to_group=True, to_merge=True): group = parser.add_mutually_exclusive_group(required=True) group.add_argument( - '-s', '--song', help='download song by spotify link or name') + '-s', '--song', + help='download track by spotify link or name') group.add_argument( - '-l', '--list', help='download songs from a file') + '-l', '--list', + help='download tracks from a file') group.add_argument( - '-p', '--playlist', help='load songs from playlist URL into .txt') + '-p', '--playlist', + help='load tracks from playlist URL into .txt') group.add_argument( - '-b', '--album', help='load songs from album URL into .txt') + '-b', '--album', + help='load tracks from album URL into .txt') group.add_argument( '-u', '--username', - help="load songs from user's playlist into .txt") + help="load tracks from user's playlist into .txt") parser.add_argument( '-m', '--manual', default=config['manual'], - help='choose the song to download manually', action='store_true') + help='choose the track to download manually from a list ' + 'of matching tracks', + action='store_true') parser.add_argument( '-nm', '--no-metadata', default=config['no-metadata'], - help='do not embed metadata in songs', action='store_true') + help='do not embed metadata in tracks', action='store_true') parser.add_argument( '-a', '--avconv', default=config['avconv'], - help='Use avconv for conversion otherwise set defaults to ffmpeg', + help='use avconv for conversion (otherwise defaults to ffmpeg)', action='store_true') parser.add_argument( '-f', '--folder', default=os.path.relpath(config['folder'], os.getcwd()), - help='path to folder where files will be stored in') + help='path to folder where downloaded tracks will be stored in') parser.add_argument( '--overwrite', default=config['overwrite'], help='change the overwrite policy', choices={'prompt', 'force', 'skip'}) parser.add_argument( '-i', '--input-ext', default=config['input-ext'], - help='prefered input format .m4a or .webm (Opus)', + help='preferred input format .m4a or .webm (Opus)', choices={'.m4a', '.webm'}) parser.add_argument( '-o', '--output-ext', default=config['output-ext'], - help='prefered output format .mp3, .m4a (AAC), .flac, etc.') + help='preferred output format .mp3, .m4a (AAC), .flac, etc.') parser.add_argument( '-ff', '--file-format', default=config['file-format'], - help='File format to save the downloaded song with, each tag ' + help='file format to save the downloaded track with, each tag ' 'is surrounded by curly braces. Possible formats: ' '{}'.format([internals.formats[x] for x in internals.formats])) parser.add_argument( '-sf', '--search-format', default=config['search-format'], - help='Search format to search for on YouTube, each tag ' + help='search format to search for on YouTube, each tag ' 'is surrounded by curly braces. Possible formats: ' '{}'.format([internals.formats[x] for x in internals.formats])) parser.add_argument( '-dm', '--download-only-metadata', default=config['download-only-metadata'], - help='download songs for which metadata is found', + help='download tracks only whose metadata is found', action='store_true') parser.add_argument( '-d', '--dry-run', default=config['dry-run'], - help='Show only track title and YouTube URL', + help='show only track title and YouTube URL, and then skip ' + 'to the next track (if any)', action='store_true') parser.add_argument( '-mo', '--music-videos-only', default=config['music-videos-only'], - help='Search only for music on Youtube', + help='search only for music videos on Youtube (works only ' + 'when YouTube API key is set', action='store_true') parser.add_argument( '-ns', '--no-spaces', default=config['no-spaces'], - help='Replace spaces with underscores in file names', + help='replace spaces with underscores in file names', action='store_true') parser.add_argument( '-ll', '--log-level', default=config['log-level'], @@ -165,7 +173,8 @@ def get_arguments(raw_args=None, to_group=True, to_merge=True): help=argparse.SUPPRESS) parser.add_argument( '-c', '--config', default=None, - help='Replace with custom config.yml file') + help='path to config.yml file (otherwise load it from same ' + 'directory as spotdl.py)') parsed = parser.parse_args(raw_args)