default to -s

This commit is contained in:
logykk 2022-02-25 14:52:30 +13:00
parent fd4e93df8b
commit e74dba6344
4 changed files with 14 additions and 2 deletions

View File

@ -3,6 +3,7 @@
## 0.6.3 ## 0.6.3
- Less stupid single format - Less stupid single format
- Fixed error in json fetching - Fixed error in json fetching
- Default to search if no other option is provided
## v0.6.2 ## v0.6.2
- Won't crash if downloading a song with no lyrics and `DOWNLOAD_LYRICS` is set to True - Won't crash if downloading a song with no lyrics and `DOWNLOAD_LYRICS` is set to True

View File

@ -25,7 +25,7 @@ def main():
parser.add_argument('--password', parser.add_argument('--password',
type=str, type=str,
help='Account password') help='Account password')
group = parser.add_mutually_exclusive_group(required=True) group = parser.add_mutually_exclusive_group(required=False)
group.add_argument('urls', group.add_argument('urls',
type=str, type=str,
# action='extend', # action='extend',

View File

@ -41,13 +41,16 @@ def client(args) -> None:
else: else:
Printer.print(PrintChannel.ERRORS, f'File {filename} not found.\n') Printer.print(PrintChannel.ERRORS, f'File {filename} not found.\n')
return
if args.urls: if args.urls:
if len(args.urls) > 0: if len(args.urls) > 0:
download_from_urls(args.urls) download_from_urls(args.urls)
return
if args.playlist: if args.playlist:
download_from_user_playlist() download_from_user_playlist()
return
if args.liked_songs: if args.liked_songs:
for song in get_saved_tracks(): 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") Printer.print(PrintChannel.SKIPS, '### SKIPPING: SONG DOES NOT EXIST ANYMORE ###' + "\n")
else: else:
download_track('liked', song[TRACK][ID]) download_track('liked', song[TRACK][ID])
return
if args.search: if args.search:
if args.search == ' ': if args.search == ' ':
@ -65,6 +69,13 @@ def client(args) -> None:
else: else:
if not download_from_urls([args.search]): if not download_from_urls([args.search]):
search(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: def download_from_urls(urls: list[str]) -> bool:
""" Downloads from a list of urls """ """ Downloads from a list of urls """

View File

@ -54,7 +54,7 @@ CONFIG_VALUES = {
TRANSCODE_BITRATE: { 'default': 'auto', 'type': str, 'arg': '--transcode-bitrate' }, TRANSCODE_BITRATE: { 'default': 'auto', 'type': str, 'arg': '--transcode-bitrate' },
SKIP_EXISTING: { 'default': 'True', 'type': bool, 'arg': '--skip-existing' }, SKIP_EXISTING: { 'default': 'True', 'type': bool, 'arg': '--skip-existing' },
SKIP_PREVIOUSLY_DOWNLOADED: { 'default': 'False', 'type': bool, 'arg': '--skip-previously-downloaded' }, 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' }, BULK_WAIT_TIME: { 'default': '1', 'type': int, 'arg': '--bulk-wait-time' },
OVERRIDE_AUTO_WAIT: { 'default': 'False', 'type': bool, 'arg': '--override-auto-wait' }, OVERRIDE_AUTO_WAIT: { 'default': 'False', 'type': bool, 'arg': '--override-auto-wait' },
CHUNK_SIZE: { 'default': '50000', 'type': int, 'arg': '--chunk-size' }, CHUNK_SIZE: { 'default': '50000', 'type': int, 'arg': '--chunk-size' },