NEW DISPLAY!
formatted all content for 1 very wide display fixed up frames and grid for all screen sizes (should scale)
This commit is contained in:
@@ -62,22 +62,24 @@ elif sys.argv[1] == "--clearChromeCache":
|
||||
os.system("rm -rf ~/.config/chromium")
|
||||
sys.exit("Deleting Chrome cache and exiting...")
|
||||
|
||||
def oauthLogin():
|
||||
if os.path.isfile(".cache-" + username) == False:
|
||||
sleep(25)
|
||||
pyautogui.press('tab')
|
||||
pyautogui.press('tab')
|
||||
pyautogui.press('tab')
|
||||
pyautogui.press('tab')
|
||||
pyautogui.write(username)
|
||||
pyautogui.press('tab')
|
||||
pyautogui.write(password)
|
||||
pyautogui.press('enter')
|
||||
sleep(90)
|
||||
if platform.system() == "Linux":
|
||||
os.system("killall chromium-browser")
|
||||
# def oauthLogin():
|
||||
# if os.path.isfile(".cache-" + username) == False:
|
||||
# sleep(25)
|
||||
# pyautogui.press('tab')
|
||||
# pyautogui.press('tab')
|
||||
# pyautogui.press('tab')
|
||||
# pyautogui.press('tab')
|
||||
# pyautogui.write(username)
|
||||
# pyautogui.press('tab')
|
||||
# pyautogui.write(password)
|
||||
# pyautogui.press('enter')
|
||||
# sleep(90)
|
||||
# if platform.system() == "Linux":
|
||||
# os.system("killall chromium-browser")
|
||||
|
||||
threading.Thread(target=oauthLogin).start()
|
||||
# threading.Thread(target=oauthLogin).start()
|
||||
|
||||
# oauthLogin()
|
||||
|
||||
token = spotipy.util.prompt_for_user_token(username, scope, client_id, client_secret, redirect_uri)
|
||||
|
||||
@@ -91,7 +93,7 @@ spotify = createToken()
|
||||
# Create the tkinter window
|
||||
root = ttk.Tk()
|
||||
root.title("Media Controller")
|
||||
root.geometry("480x320")
|
||||
root.geometry("1280x400")
|
||||
root.attributes("-topmost", True)
|
||||
root.overrideredirect(1)
|
||||
sv_ttk.use_dark_theme()
|
||||
@@ -214,31 +216,35 @@ album_art_img = ""
|
||||
|
||||
canvas = ttk.Canvas(root, width=480, height=320)
|
||||
|
||||
frame_artist_song = tk.Frame(root)
|
||||
frame_controls = tk.Frame(root)
|
||||
frame_artist_song = tk.Frame(root, width=(1280/3), height=400)
|
||||
# frame_controls = tk.Frame(root)
|
||||
lyrics_button = tk.Frame(root)
|
||||
album_art_frame = tk.Frame(root)
|
||||
lyrics_label_frame = tk.Frame(root, width=(1280/3), height=400)
|
||||
lyrics_label_frame.grid_propagate(0)
|
||||
|
||||
root.grid_rowconfigure(0, weight=1)
|
||||
root.grid_rowconfigure(1, weight=1)
|
||||
root.grid_rowconfigure(2, weight=1)
|
||||
root.grid_rowconfigure(3, weight=1)
|
||||
root.grid_columnconfigure(0, weight=1)
|
||||
root.grid_columnconfigure(1, weight=1)
|
||||
root.grid_columnconfigure(2, weight=1)
|
||||
# root.grid_columnconfigure(2, weight=1)
|
||||
|
||||
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_controls, image=play_img, command=play, borderwidth=0, relief=None)
|
||||
pause_button = ttk.Button(frame_controls, image=pause_img, command=pause, borderwidth=0)
|
||||
next_button = ttk.Button(frame_controls, image=next_img, command=next, borderwidth=0)
|
||||
previous_button = ttk.Button(frame_controls, image=previous_img, command=previous, borderwidth=0)
|
||||
play_button = ttk.Button(frame_artist_song, image=play_img, command=play, borderwidth=0, relief=None)
|
||||
pause_button = ttk.Button(frame_artist_song, image=pause_img, command=pause, borderwidth=0)
|
||||
next_button = ttk.Button(frame_artist_song, image=next_img, command=next, borderwidth=0)
|
||||
previous_button = ttk.Button(frame_artist_song, image=previous_img, command=previous, 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)
|
||||
volumeslider_button = tk.Scale(root, from_=100, to=0, orient=ttk.VERTICAL, length=240, command=volumeslider)
|
||||
#doaudio_analysis = tk.Button(root, text="Audio Analysis", command=doaudioanalysis)
|
||||
artist_label = tk.Label(frame_artist_song, text="", font=("Helvetica", 32))
|
||||
song_label = tk.Label(frame_artist_song, text="", font=("Helvetica", 24))
|
||||
artist_label = tk.Label(frame_artist_song, text="", font=("Helvetica", 32), wraplength=(1280/3), justify=ttk.CENTER)
|
||||
song_label = tk.Label(frame_artist_song, text="", font=("Helvetica", 24), wraplength=(1280/3), justify=ttk.CENTER)
|
||||
track_progress_label = tk.Label(root, text="")
|
||||
track_duration_label = tk.Label(root, text="")
|
||||
# track_combined_label = tk.Label(root, text="")
|
||||
@@ -249,11 +255,11 @@ start_playback_on_device_button = tk.Button(root, text="Start Playback on Device
|
||||
# hide_devices_button = tk.Button(root, text="Hide Devices", command=hide_devices)
|
||||
username_label = tk.Label(root, text="Username: " + spotify.me()["display_name"])
|
||||
devices_list = ttk.Listbox(root, selectmode=ttk.SINGLE, font=("Helvetica", 18))
|
||||
progress_bar = tk.Progressbar(root, orient=ttk.HORIZONTAL, length=480)
|
||||
progress_bar = tk.Progressbar(root, orient=ttk.HORIZONTAL, length=1280)
|
||||
searching_for_devices_label = tk.Label(root, text="Searching for Devices...", font=("Helvetica", 24))
|
||||
device_name_label = tk.Label(frame_artist_song, text="", font=("Helvetica", 12))
|
||||
# background_image_label = tk.Label(root, image=album_art_img)
|
||||
lyrics_label = tk.Label(root, text="", font=("Helvetica", 32))
|
||||
lyrics_label = tk.Label(lyrics_label_frame, text="", font=("Helvetica", 32), wraplength=(1280/3), justify=ttk.CENTER)
|
||||
loadLyrics_button = ttk.Button(lyrics_button, image=lyrics_img, command=loadLyrics_pressed, borderwidth=0)
|
||||
# album_art_canvas = ttk.Canvas(root)
|
||||
# album_art_canvas_create_image = album_art_canvas.create_image(0, 0, image=album_art_img)
|
||||
@@ -316,8 +322,8 @@ def update_song_label():
|
||||
for line in str(lrc).splitlines():
|
||||
if track_progress_formatted in line:
|
||||
lyric = line.split("]")[1]
|
||||
wrapped_lyric = textwrap.fill(lyric, 21)
|
||||
lyrics_label.config(text=wrapped_lyric)
|
||||
# wrapped_lyric = textwrap.fill(lyric, 21)
|
||||
lyrics_label.config(text=lyric)
|
||||
root.after(800, update_song_label)
|
||||
else:
|
||||
# album_art_data = Image.open(requests.get(album_art_url, stream=True).raw)
|
||||
@@ -330,7 +336,7 @@ def update_song_label():
|
||||
lyrics_label.config(text="")
|
||||
lrc = syncedlyrics.search("[" + track_name + "] [" + artist_name + "]")
|
||||
album_art_img_data = requests.get(album_art_url).content
|
||||
album_art_img = ImageTk.PhotoImage(Image.open(BytesIO(album_art_img_data)).resize((480,480)))
|
||||
album_art_img = ImageTk.PhotoImage(Image.open(BytesIO(album_art_img_data)).resize((300,300)))
|
||||
album_art_label.config(image=album_art_img)
|
||||
# album_art_label.grid_forget()
|
||||
# album_art_label.grid()
|
||||
@@ -345,32 +351,36 @@ def update_song_label():
|
||||
# pass
|
||||
if playing_status == True:
|
||||
play_button.grid_forget()
|
||||
pause_button.grid(row=0, column=1)
|
||||
pause_button.grid(row=3, column=1, pady=(100,0))
|
||||
elif playing_status == False:
|
||||
pause_button.grid_forget()
|
||||
play_button.grid(row=0, column=1)
|
||||
play_button.grid(row=3, column=1, pady=(100,0))
|
||||
else:
|
||||
pass
|
||||
|
||||
def loadNow_playing():
|
||||
# background_image_label.place(x=0, y=0)
|
||||
volumeslider_button.grid(row=1, column=1, rowspan=3, sticky="e", padx=(0,20))
|
||||
lyrics_button.grid(row=1, column=1, padx=(0,380))
|
||||
frame_artist_song.grid(row=1, column=1, pady=(0,5))
|
||||
frame_controls.grid(row=2, column=1, pady=(20,0))
|
||||
loadLyrics_button.grid()
|
||||
device_name_label.grid(pady=(0,5))
|
||||
artist_label.grid()
|
||||
song_label.grid()
|
||||
previous_button.grid(row=0, column=0, padx=(0,10))
|
||||
play_button.grid(row=0, column=1)
|
||||
next_button.grid(row=0, column=2, padx=(10,0))
|
||||
progress_bar.grid(row=3, column=1)
|
||||
# volumeslider_button.grid(row=1, column=1, rowspan=3, sticky="e", padx=(0,20))
|
||||
# lyrics_button.grid(row=1, column=1, padx=(0,380))
|
||||
frame_artist_song.grid(row=0, column=1, rowspan=3, pady=(20,0))
|
||||
# frame_controls.grid(row=2, column=1)
|
||||
# loadLyrics_button.grid()
|
||||
device_name_label.grid(row=0, column=1)
|
||||
artist_label.grid(row=1, column=1)
|
||||
song_label.grid(row=2, column=1)
|
||||
previous_button.grid(row=3, column=1, padx=(0,200), pady=(100,0))
|
||||
play_button.grid(row=3, column=1, pady=(100,0))
|
||||
next_button.grid(row=3, column=1, padx=(200,0), pady=(100,0))
|
||||
progress_bar.grid(row=3, column=0, columnspan=3)
|
||||
album_art_frame.grid(row=0, column=0, rowspan=4)
|
||||
album_art_label.grid(sticky="w")
|
||||
lyrics_label_frame.grid(row=0, column=2, rowspan=4)
|
||||
lyrics_label.grid()
|
||||
|
||||
def unloadNow_playing():
|
||||
volumeslider_button.grid_forget()
|
||||
frame_artist_song.grid_forget()
|
||||
frame_controls.grid_forget()
|
||||
# frame_controls.grid_forget()
|
||||
artist_label.grid_forget()
|
||||
song_label.grid_forget()
|
||||
previous_button.grid_forget()
|
||||
|
||||
Reference in New Issue
Block a user