From e74dba6344e78f587f5fcedd3433ec8d81355461 Mon Sep 17 00:00:00 2001 From: logykk Date: Fri, 25 Feb 2022 14:52:30 +1300 Subject: [PATCH] default to -s --- CHANGELOG.md | 1 + zotify/__main__.py | 2 +- zotify/app.py | 11 +++++++++++ zotify/config.py | 2 +- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ea4a3ea..65266e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## 0.6.3 - Less stupid single format - Fixed error in json fetching +- Default to search if no other option is provided ## v0.6.2 - Won't crash if downloading a song with no lyrics and `DOWNLOAD_LYRICS` is set to True diff --git a/zotify/__main__.py b/zotify/__main__.py index 7a44638..11a2c3f 100644 --- a/zotify/__main__.py +++ b/zotify/__main__.py @@ -25,7 +25,7 @@ def main(): parser.add_argument('--password', type=str, help='Account password') - group = parser.add_mutually_exclusive_group(required=True) + group = parser.add_mutually_exclusive_group(required=False) group.add_argument('urls', type=str, # action='extend', diff --git a/zotify/app.py b/zotify/app.py index 58424e0..131256d 100644 --- a/zotify/app.py +++ b/zotify/app.py @@ -41,13 +41,16 @@ def client(args) -> None: else: Printer.print(PrintChannel.ERRORS, f'File {filename} not found.\n') + return if args.urls: if len(args.urls) > 0: download_from_urls(args.urls) + return if args.playlist: download_from_user_playlist() + return if args.liked_songs: for song in get_saved_tracks(): @@ -55,6 +58,7 @@ def client(args) -> None: Printer.print(PrintChannel.SKIPS, '### SKIPPING: SONG DOES NOT EXIST ANYMORE ###' + "\n") else: download_track('liked', song[TRACK][ID]) + return if args.search: if args.search == ' ': @@ -65,6 +69,13 @@ def client(args) -> None: else: if not download_from_urls([args.search]): search(args.search) + return + + else: + search_text = '' + while len(search_text) == 0: + search_text = input('Enter search or URL: ') + search(search_text) def download_from_urls(urls: list[str]) -> bool: """ Downloads from a list of urls """ diff --git a/zotify/config.py b/zotify/config.py index d8256b5..7385580 100644 --- a/zotify/config.py +++ b/zotify/config.py @@ -54,7 +54,7 @@ CONFIG_VALUES = { TRANSCODE_BITRATE: { 'default': 'auto', 'type': str, 'arg': '--transcode-bitrate' }, SKIP_EXISTING: { 'default': 'True', 'type': bool, 'arg': '--skip-existing' }, SKIP_PREVIOUSLY_DOWNLOADED: { 'default': 'False', 'type': bool, 'arg': '--skip-previously-downloaded' }, - RETRY_ATTEMPTS: { 'default': '5', 'type': int, 'arg': '--retry-attemps' }, + RETRY_ATTEMPTS: { 'default': '1', 'type': int, 'arg': '--retry-attemps' }, BULK_WAIT_TIME: { 'default': '1', 'type': int, 'arg': '--bulk-wait-time' }, OVERRIDE_AUTO_WAIT: { 'default': 'False', 'type': bool, 'arg': '--override-auto-wait' }, CHUNK_SIZE: { 'default': '50000', 'type': int, 'arg': '--chunk-size' },