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
|
import tkinter as ttk
|
||||||
from tkinter import ttk as tk
|
from tkinter import ttk as tk
|
||||||
import random
|
import random
|
||||||
import json
|
|
||||||
import sv_ttk
|
import sv_ttk
|
||||||
from urllib.request import urlopen
|
from urllib.request import urlopen
|
||||||
import requests
|
import requests
|
||||||
from time import sleep
|
from time import sleep
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import pyautogui
|
|
||||||
import threading
|
|
||||||
import platform
|
import platform
|
||||||
import syncedlyrics
|
import syncedlyrics
|
||||||
import textwrap
|
|
||||||
from PIL import Image, ImageTk
|
from PIL import Image, ImageTk
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
import math
|
import math
|
||||||
@@ -244,10 +240,10 @@ lyrics_label_frame.grid_rowconfigure(0, weight=1)
|
|||||||
lyrics_label_frame.grid_columnconfigure(0, weight=1)
|
lyrics_label_frame.grid_columnconfigure(0, weight=1)
|
||||||
|
|
||||||
# Create the media control buttons and a text label
|
# 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)
|
play_button = ttk.Label(frame_artist_song, image=play_img, borderwidth=0)
|
||||||
pause_button = ttk.Button(frame_artist_song, image=pause_img, command=pause, borderwidth=0, background=bg_color)
|
pause_button = ttk.Label(frame_artist_song, image=pause_img, borderwidth=0)
|
||||||
next_button = ttk.Button(frame_artist_song, image=next_img, command=next, borderwidth=0, background=bg_color)
|
next_button = ttk.Label(frame_artist_song, image=next_img, borderwidth=0)
|
||||||
previous_button = ttk.Button(frame_artist_song, image=previous_img, command=previous, borderwidth=0, background=bg_color)
|
previous_button = ttk.Label(frame_artist_song, image=previous_img, borderwidth=0)
|
||||||
maxvolume_button = tk.Button(root, text="Max Volume", command=maxvolume)
|
maxvolume_button = tk.Button(root, text="Max Volume", command=maxvolume)
|
||||||
minvolume_button = tk.Button(root, text="Min Volume", command=minvolume)
|
minvolume_button = tk.Button(root, text="Min Volume", command=minvolume)
|
||||||
randomvolume_button = tk.Button(root, text="Random Volume", command=randomvolume)
|
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)
|
root.bind("<Return>", search)
|
||||||
lyrics_label.bind("<Button-1>", lambda e:unloadLyrics_pressed())
|
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
|
# Function to update the song label with the current track's name
|
||||||
def update_song_label():
|
def update_song_label():
|
||||||
global lrc
|
global lrc
|
||||||
global album_art_img
|
global album_art_img
|
||||||
# Get the current playback information
|
# Get the current playback information
|
||||||
try:
|
while True:
|
||||||
current_playback = spotify.current_playback()
|
try:
|
||||||
except (spotipy.exceptions.SpotifyException, requests.exceptions.HTTPError):
|
current_playback = spotify.current_playback()
|
||||||
createToken()
|
break
|
||||||
current_playback = spotify.current_playback()
|
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 there is no current playback, set the text of the song label to "No playback"
|
||||||
if current_playback is None:
|
if current_playback is None:
|
||||||
# nothing_playing_obj = '{"item": {"artists": [{"name": "Nothing Playing"}],"duration_ms": 0,"name": "Nothing Playing"},"progress_ms": 0}'
|
# 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()
|
get_devices()
|
||||||
# Update the song label every 1 second
|
# Update the song label every 1 second
|
||||||
else:
|
else:
|
||||||
try:
|
track_name = current_playback["item"]["name"]
|
||||||
track_name = current_playback["item"]["name"]
|
|
||||||
pass
|
|
||||||
except TypeError:
|
|
||||||
sleep(1000)
|
|
||||||
update_song_label()
|
|
||||||
artist_name = current_playback["item"]["artists"][0]["name"]
|
artist_name = current_playback["item"]["artists"][0]["name"]
|
||||||
track_duration = current_playback["item"]["duration_ms"]
|
track_duration = current_playback["item"]["duration_ms"]
|
||||||
track_progress = current_playback["progress_ms"]
|
track_progress = current_playback["progress_ms"]
|
||||||
|
|||||||