added liking by double tapping album art

add exception handling to update.py, prepping for handling script
This commit is contained in:
Brandon4466
2023-03-04 13:46:12 -08:00
parent c66ee19a25
commit 88c877c50f
4 changed files with 23 additions and 9 deletions

View File

@@ -54,7 +54,7 @@ password = "Mariposa2502$"
# Get the user's Spotify authorization token
scope = "user-read-playback-state,user-modify-playback-state"
scope = "user-read-playback-state,user-modify-playback-state,user-library-read,user-library-modify"
oauth = SpotifyOAuth(client_id=client_id, client_secret=client_secret, redirect_uri=redirect_uri, scope=scope, requests_timeout=30)
@@ -95,8 +95,10 @@ def controlPrevious():
spotify.previous_track()
def likeSong():
print(spotify.current_playback()["item"]["id"])
spotify.current_user_saved_tracks_add(tracks=(spotify.current_playback()["item"]["id"]))
if spotify.current_user_saved_tracks_contains(tracks=[(spotify.current_playback()["item"]["id"])])[0] is False:
spotify.current_user_saved_tracks_add(tracks=[(spotify.current_playback()["item"]["id"])])
else:
spotify.current_user_saved_tracks_delete(tracks=[(spotify.current_playback()["item"]["id"])])
def start_playback_on_device():
# global count
@@ -302,10 +304,13 @@ def update_song_label():
track_progress_sec = (track_progress//1000)%60
else:
track_name = "Loading..."
artist_name = "Loading..."
artist_name = ""
track_duration = 1
track_progress = 1
playing_status = True
device_name = ""
album_art_url = ""
track_progress_min = 0
track_progress_sec = 1
if track_name == song_label.cget("text"):
track_progress_formatted = ("{}:{:02d}".format(track_progress_min, track_progress_sec))
progress_bar.config(maximum=track_duration)