From ef4d0fee66e956ac4c3a4fe1a31b818fbf83730b Mon Sep 17 00:00:00 2001 From: Brandon4466 Date: Tue, 21 Mar 2023 22:21:45 -0700 Subject: [PATCH] fixed bug in liking songs --- .cache | 2 +- spotifycontroller.py | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.cache b/.cache index bf36bc1..9936314 100644 --- a/.cache +++ b/.cache @@ -1 +1 @@ -{"access_token": "BQB1g4gwPqYVjNK4nO_yo-cpklfGJr3UxL5hIveI0mJjE5SppjfNnpNbvAwC2He9r1SdAPmWfDnNER1XjgNb_RlNDZVYpXTE-D46mfoLc-f-rnR7vagnY5OL7KULnDoYQkp1iOZwDUmOAWxtBKVQSzRG9coPbh7NfB75Iz42zJYu6IneT4E-R0FOJSW3bkTKjbenqn4zMsnoPyKwQmOi", "token_type": "Bearer", "expires_in": 3600, "refresh_token": "AQC5BsmRqj_PhCL7Xj32C6Pz4UeFF09ZufzWv0NU1lGwZCUGaWAQP8F4twJf3Rx5EfKyAg4DIEnHZIFd6e5L4bPQXhPUny2t7A1AA5hCwfFI_LjXWWPij8oKX_0YDr6CXK0", "scope": "user-library-modify user-library-read user-modify-playback-state user-read-playback-state", "expires_at": 1678338237} \ No newline at end of file +{"access_token": "BQAwNuSTPsxO_L1DyV-7sSX_5ymdMsBTCQl1K7JBu0S2dTa6sHzUbgwKECv3zMdlKwiopbW7a7tz1yVllgKqGAMZxgFeitoAenswfmYaT2buecmrYiA28bWh14PW26Ypdg_bJWz3x40bT9QP4dF-8vu23d_-FOVUTT0EcO7t6zI95GtB2Awp2z98VAQ_MdUFWohptYtD5HXg7qK2nnvi", "token_type": "Bearer", "expires_in": 3600, "scope": "user-library-modify user-library-read user-modify-playback-state user-read-playback-state", "expires_at": 1679465977, "refresh_token": "AQC5BsmRqj_PhCL7Xj32C6Pz4UeFF09ZufzWv0NU1lGwZCUGaWAQP8F4twJf3Rx5EfKyAg4DIEnHZIFd6e5L4bPQXhPUny2t7A1AA5hCwfFI_LjXWWPij8oKX_0YDr6CXK0"} \ No newline at end of file diff --git a/spotifycontroller.py b/spotifycontroller.py index 8f15162..ce3a942 100644 --- a/spotifycontroller.py +++ b/spotifycontroller.py @@ -97,10 +97,10 @@ def controlNext(): def controlPrevious(): spotify.previous_track() -def likeSong(is_bright): +def likeSong(): 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"])]) - if is_bright is True: + if isBright is True: play_button.config(image=play_heart_img_black) pause_button.config(image=pause_heart_img_black) else: @@ -108,7 +108,7 @@ def likeSong(is_bright): pause_button.config(image=pause_heart_img) else: spotify.current_user_saved_tracks_delete(tracks=[(spotify.current_playback()["item"]["id"])]) - if is_bright is True: + if isBright is True: play_button.config(image=play_img_black) pause_button.config(image=pause_img_black) else: @@ -338,6 +338,7 @@ album_art_label.bind("", lambda e:likeSong()) def update_song_label(): global lrc global album_art_img + global isBright # Get the current playback information current_playback = spotify.current_playback() # If there is no current playback, set the text of the song label to "No playback" @@ -396,7 +397,7 @@ def update_song_label(): previous_button.config(background=bg_color) lyrics_label_frame.config(background=bg_color) lyrics_label.config(background=bg_color) - colorUI(track_id, album_art_img_open) + isBright = colorUI(track_id, album_art_img_open) # print(oauth.get_cached_token()["access_token"]) # print(current_playback["item"]["id"]) # canvas_url = canvas.get_canvas_for_track(access_token=oauth.get_cached_token()["access_token"], track_id=current_playback["item"]["id"])