From 509dbb1e45128e979e7c8c34193748a9db10fec8 Mon Sep 17 00:00:00 2001 From: Jared Rossberg Date: Sat, 23 Oct 2021 17:17:04 -0600 Subject: [PATCH] Reprompt when no input given --- src/app.py | 8 ++++++-- src/zspotify.py | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/app.py b/src/app.py index 6a809ca..abd8b87 100644 --- a/src/app.py +++ b/src/app.py @@ -61,7 +61,9 @@ def client() -> None: download_episode(episode) else: - search_text = input('Enter search or URL: ') + search_text = '' + while len(search_text) == 0: + search_text = input('Enter search or URL: ') track_id, album_id, playlist_id, episode_id, show_id, artist_id = regex_input_for_urls(search_text) @@ -149,7 +151,9 @@ def search(search_term): if len(tracks) + len(albums) + len(playlists) == 0: print('NO RESULTS FOUND - EXITING...') else: - selection = str(input('SELECT ITEM(S) BY S.NO: ')) + selection = '' + while len(selection) == 0: + selection = str(input('SELECT ITEM(S) BY S.NO: ')) inputs = split_input(selection) for pos in inputs: position = int(pos) diff --git a/src/zspotify.py b/src/zspotify.py index 5e70c2b..98aaa6f 100644 --- a/src/zspotify.py +++ b/src/zspotify.py @@ -43,7 +43,9 @@ class ZSpotify: except RuntimeError: pass while True: - user_name = input('Username: ') + user_name = '' + while len(user_name) == 0: + user_name = input('Username: ') password = getpass() try: cls.SESSION = Session.Builder().user_pass(user_name, password).create()