From 33895d4f6210500280241379ad3ad01759decb10 Mon Sep 17 00:00:00 2001 From: Footsiefat <12180913+Footsiefat@users.noreply.github.com> Date: Thu, 21 Oct 2021 20:02:35 +1300 Subject: [PATCH] Added option to just paste URL in search bar --- zspotify.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/zspotify.py b/zspotify.py index 17cb05b7..80e639f8 100755 --- a/zspotify.py +++ b/zspotify.py @@ -132,7 +132,25 @@ def client(): download_episode(episode_id_str) else: search_text = input("Enter search or URL: ") - search(search_text) + + track_id_str, album_id_str, playlist_id_str, episode_id_str = regex_input_for_urls( + search_text) + + if track_id_str is not None: + download_track(track_id_str) + elif album_id_str is not None: + download_album(album_id_str) + elif playlist_id_str is not None: + playlist_songs = get_playlist_songs(token, playlist_id_str) + name, creator = get_playlist_info(token, playlist_id_str) + for song in playlist_songs: + download_track(song['track']['id'], + sanitize_data(name) + "/") + print("\n") + elif episode_id_str is not None: + download_episode(episode_id_str) + else: + search(search_text) wait()