FIXED RECURSION
had some bad recursion in the function, fixed with a while loop
@@ -1 +1 @@
|
||||
{"access_token": "BQCekaBvjmyM9f12lOetax1Wqzc6TSlwiySg4aEIc_10eH09pQPEX89ZAiZCDnXC4U94N98wg6R3DqS0SJh5EqykeuO29RIK9uVPaArOob6pYRhlNdeQuDuc_UGKzuND_JUy7Bd7XlYjAbcxiemBJjGfx44gAAJD-IDbPTSTQ_PoYZtOie7JtIF2XNQTgw", "token_type": "Bearer", "expires_in": 3600, "scope": "user-modify-playback-state user-read-playback-state", "expires_at": 1673746986, "refresh_token": "AQBb9zPnT-MmK7H70IzzenfZBz1VV-0eZWhD73x2br6xQPx1jctO-uuGZu38EvvXapCpdJZ8oLAk4Z4Ci2gmZGGfMsmsofMNVB402gjRrSzfV94BpkuYJtyV0fS5bSK5Nrg"}
|
||||
{"access_token": "BQBDvdX_R5Ytk8IWYKvSfQ-xvTD3fJHLEXy5-EwVm6ukngDvG5Hlz6F0LWdjLuUMVmcJi24IYljaF2l396aeE0kcnX8X12rYcyMpy6kIUH3i_jL1xg4egPSZ8Lr41l7xHIw7BJQkuXN-yewbNo2quC_i32BtpYncurovWcSKYjLjfO8LC9_L7Z3IWhu1bw", "token_type": "Bearer", "expires_in": 3600, "scope": "user-modify-playback-state user-read-playback-state", "expires_at": 1673754361, "refresh_token": "AQBb9zPnT-MmK7H70IzzenfZBz1VV-0eZWhD73x2br6xQPx1jctO-uuGZu38EvvXapCpdJZ8oLAk4Z4Ci2gmZGGfMsmsofMNVB402gjRrSzfV94BpkuYJtyV0fS5bSK5Nrg"}
|
||||
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 832 B After Width: | Height: | Size: 969 B |
|
Before Width: | Height: | Size: 828 B After Width: | Height: | Size: 960 B |
@@ -3,18 +3,14 @@ import spotipy.util
|
||||
import tkinter as ttk
|
||||
from tkinter import ttk as tk
|
||||
import random
|
||||
import json
|
||||
import sv_ttk
|
||||
from urllib.request import urlopen
|
||||
import requests
|
||||
from time import sleep
|
||||
import sys
|
||||
import os
|
||||
import pyautogui
|
||||
import threading
|
||||
import platform
|
||||
import syncedlyrics
|
||||
import textwrap
|
||||
from PIL import Image, ImageTk
|
||||
from io import BytesIO
|
||||
import math
|
||||
@@ -244,10 +240,10 @@ lyrics_label_frame.grid_rowconfigure(0, weight=1)
|
||||
lyrics_label_frame.grid_columnconfigure(0, weight=1)
|
||||
|
||||
# Create the media control buttons and a text label
|
||||
play_button = ttk.Button(frame_artist_song, image=play_img, command=play, borderwidth=0, relief=None, background=bg_color)
|
||||
pause_button = ttk.Button(frame_artist_song, image=pause_img, command=pause, borderwidth=0, background=bg_color)
|
||||
next_button = ttk.Button(frame_artist_song, image=next_img, command=next, borderwidth=0, background=bg_color)
|
||||
previous_button = ttk.Button(frame_artist_song, image=previous_img, command=previous, borderwidth=0, background=bg_color)
|
||||
play_button = ttk.Label(frame_artist_song, image=play_img, borderwidth=0)
|
||||
pause_button = ttk.Label(frame_artist_song, image=pause_img, borderwidth=0)
|
||||
next_button = ttk.Label(frame_artist_song, image=next_img, borderwidth=0)
|
||||
previous_button = ttk.Label(frame_artist_song, image=previous_img, borderwidth=0)
|
||||
maxvolume_button = tk.Button(root, text="Max Volume", command=maxvolume)
|
||||
minvolume_button = tk.Button(root, text="Min Volume", command=minvolume)
|
||||
randomvolume_button = tk.Button(root, text="Random Volume", command=randomvolume)
|
||||
@@ -277,18 +273,22 @@ album_art_label = tk.Label(album_art_frame, image=album_art_img)
|
||||
|
||||
root.bind("<Return>", search)
|
||||
lyrics_label.bind("<Button-1>", lambda e:unloadLyrics_pressed())
|
||||
album_art_label.bind("<Button-1>", lambda e:unloadLyrics_pressed())
|
||||
play_button.bind("<Button-1>", lambda e:play())
|
||||
pause_button.bind("<Button-1>", lambda e:pause())
|
||||
next_button.bind("<Button-1>", lambda e:next())
|
||||
previous_button.bind("<Button-1>", lambda e:previous())
|
||||
|
||||
# Function to update the song label with the current track's name
|
||||
def update_song_label():
|
||||
global lrc
|
||||
global album_art_img
|
||||
# Get the current playback information
|
||||
try:
|
||||
current_playback = spotify.current_playback()
|
||||
except (spotipy.exceptions.SpotifyException, requests.exceptions.HTTPError):
|
||||
createToken()
|
||||
current_playback = spotify.current_playback()
|
||||
while True:
|
||||
try:
|
||||
current_playback = spotify.current_playback()
|
||||
break
|
||||
except (spotipy.exceptions.SpotifyException, requests.exceptions.HTTPError):
|
||||
createToken()
|
||||
# If there is no current playback, set the text of the song label to "No playback"
|
||||
if current_playback is None:
|
||||
# nothing_playing_obj = '{"item": {"artists": [{"name": "Nothing Playing"}],"duration_ms": 0,"name": "Nothing Playing"},"progress_ms": 0}'
|
||||
@@ -296,12 +296,7 @@ def update_song_label():
|
||||
get_devices()
|
||||
# Update the song label every 1 second
|
||||
else:
|
||||
try:
|
||||
track_name = current_playback["item"]["name"]
|
||||
pass
|
||||
except TypeError:
|
||||
sleep(1000)
|
||||
update_song_label()
|
||||
track_name = current_playback["item"]["name"]
|
||||
artist_name = current_playback["item"]["artists"][0]["name"]
|
||||
track_duration = current_playback["item"]["duration_ms"]
|
||||
track_progress = current_playback["progress_ms"]
|
||||
|
||||