diff --git a/.cache-thebrandon45 b/.cache-thebrandon45 index 586ba27..3814815 100644 --- a/.cache-thebrandon45 +++ b/.cache-thebrandon45 @@ -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"} \ No newline at end of file +{"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"} \ No newline at end of file diff --git a/icons/pause-circle-x2-black.png b/icons/pause-circle-x2-black.png index 7f81be9..2e127ea 100644 Binary files a/icons/pause-circle-x2-black.png and b/icons/pause-circle-x2-black.png differ diff --git a/icons/play-circle-x2-black.png b/icons/play-circle-x2-black.png index f58a747..6aa0a3b 100644 Binary files a/icons/play-circle-x2-black.png and b/icons/play-circle-x2-black.png differ diff --git a/icons/skip-next-x2-black.png b/icons/skip-next-x2-black.png index a8fca1a..f21351a 100644 Binary files a/icons/skip-next-x2-black.png and b/icons/skip-next-x2-black.png differ diff --git a/icons/skip-previous-x2-black.png b/icons/skip-previous-x2-black.png index 3cdda55..b0388f7 100644 Binary files a/icons/skip-previous-x2-black.png and b/icons/skip-previous-x2-black.png differ diff --git a/program-embedded.py b/program-embedded.py index 3eef841..5a39283 100644 --- a/program-embedded.py +++ b/program-embedded.py @@ -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("", search) lyrics_label.bind("", lambda e:unloadLyrics_pressed()) -album_art_label.bind("", lambda e:unloadLyrics_pressed()) +play_button.bind("", lambda e:play()) +pause_button.bind("", lambda e:pause()) +next_button.bind("", lambda e:next()) +previous_button.bind("", 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"]