fixed bug in liking songs

This commit is contained in:
Brandon4466
2023-03-21 22:21:45 -07:00
parent 1c4024be7d
commit ef4d0fee66
2 changed files with 6 additions and 5 deletions

2
.cache
View File

@@ -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} {"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"}

View File

@@ -97,10 +97,10 @@ def controlNext():
def controlPrevious(): def controlPrevious():
spotify.previous_track() 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: 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"])]) 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) play_button.config(image=play_heart_img_black)
pause_button.config(image=pause_heart_img_black) pause_button.config(image=pause_heart_img_black)
else: else:
@@ -108,7 +108,7 @@ def likeSong(is_bright):
pause_button.config(image=pause_heart_img) pause_button.config(image=pause_heart_img)
else: else:
spotify.current_user_saved_tracks_delete(tracks=[(spotify.current_playback()["item"]["id"])]) 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) play_button.config(image=play_img_black)
pause_button.config(image=pause_img_black) pause_button.config(image=pause_img_black)
else: else:
@@ -338,6 +338,7 @@ album_art_label.bind("<Button-1>", lambda e:likeSong())
def update_song_label(): def update_song_label():
global lrc global lrc
global album_art_img global album_art_img
global isBright
# Get the current playback information # Get the current playback information
current_playback = spotify.current_playback() current_playback = spotify.current_playback()
# If there is no current playback, set the text of the song label to "No 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) previous_button.config(background=bg_color)
lyrics_label_frame.config(background=bg_color) lyrics_label_frame.config(background=bg_color)
lyrics_label.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(oauth.get_cached_token()["access_token"])
# print(current_playback["item"]["id"]) # 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"]) # canvas_url = canvas.get_canvas_for_track(access_token=oauth.get_cached_token()["access_token"], track_id=current_playback["item"]["id"])