-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathosc-chat-tools.py
2757 lines (2587 loc) · 150 KB
/
osc-chat-tools.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import os
import time
import threading
from threading import Thread, Lock
import ast
import requests
from collections import defaultdict
import ctypes
import json
#import traceback
import re
import PySimpleGUI as sg
import argparse
from datetime import datetime, timezone
from pythonosc import udp_client
import keyboard
import asyncio
import psutil
import webbrowser
from winsdk.windows.media.control import \
GlobalSystemMediaTransportControlsSessionManager as MediaManager
import winsdk.windows.media.control as wmc
from websocket import create_connection # websocket-client
from pythonosc.dispatcher import Dispatcher
from pythonosc import osc_server
import socket
import pyperclip
from flask import Flask, request
from werkzeug.serving import make_server
import hashlib
import base64
#import GPUtil
from pynvml import *
from tendo import singleton
#importantest variables :)
run = True
playMsg = True
version = "1.5.15"
#Deprecated Variables
deprecated_topTextToggle = False #Deprecated, only in use for converting old save files
deprecated_topTimeToggle = False #Deprecated, only in use for converting old save files
deprecated_topSongToggle = False #Deprecated, only in use for converting old save files
deprecated_topCPUToggle = False #Deprecated, only in use for converting old save files
deprecated_topRAMToggle = False #Deprecated, only in use for converting old save files
deprecated_topNoneToggle = True #Deprecated, only in use for converting old save files
deprecated_topHRToggle = False #Deprecated, only in use for converting old save files
deprecated_bottomHRToggle = False #Deprecated, only in use for converting old save files
deprecated_bottomTextToggle = False #Deprecated, only in use for converting old save files
deprecated_deprecated_bottomTimeToggle = False #Deprecated, only in use for converting old save files
deprecated_bottomSongToggle = False #Deprecated, only in use for converting old save files
deprecated_bottomCPUToggle = False #Deprecated, only in use for converting old save files
deprecated_bottomRAMToggle = False #Deprecated, only in use for converting old save files
deprecated_bottomNoneToggle = True #Deprecated, only in use for converting old save files
deprecated_hideMiddle = False #Deprecated, only in use for converting old save files
#conf variables
message_delay = 1.5 # in conf
messageString = '' #in conf
FileToRead = '' #in conf
scrollText = False #in conf
scrollTexTSpeed = 6
hideSong = False #in conf
hideOutside = True #in conf
showPaused = True #in conf
songDisplay = ' 🎵\'{title}\' ᵇʸ {artist}🎶' #in conf
showOnChange = False #in conf
songChangeTicks = 1 #in conf
minimizeOnStart = False #in conf
keybind_run = '`' #in conf
keybind_afk = 'end' #in conf
topBar = '╔═════════════╗' #in conf
middleBar = '╠═════════════╣' #in conf
bottomBar = '╚═════════════╝' #in conf
avatarHR = False #in conf
blinkOverride = False #in conf
blinkSpeed = .5 #in conf
useAfkKeybind = False #in conf
toggleBeat = True #in conf
updatePrompt = True #in conf
outOfDate = False
confVersion = '' #in conf
oscListenAddress = '127.0.0.1' #in conf
oscListenPort = '9001' #in conf
oscSendAddress = '127.0.0.1' #in conf
oscSendPort = '9000' #in conf
oscForewordAddress = '127.0.0.1' #in conf
oscForewordPort = '9002' #in conf
oscListen = False #in conf
oscForeword = False #in conf
logOutput = False #in conf
layoutString = '' #in conf
verticalDivider = "〣" #in conf
cpuDisplay = 'ᴄᴘᴜ: {cpu_percent}%'#in conf
ramDisplay = 'ʀᴀᴍ: {ram_percent}% ({ram_used}/{ram_total})'#in conf
gpuDisplay = 'ɢᴘᴜ: {gpu_percent}%'#in conf
hrDisplay = '💓 {hr}'#in conf
playTimeDisplay = '⏳{hours}:{remainder_minutes}'#in conf
mutedDisplay = 'Muted 🔇'#in conf
unmutedDisplay = '🔊'#in conf
darkMode = True #in conf
sendBlank = True
suppressDuplicates = False
sendASAP = False
useMediaManager = True
useSpotifyApi = False
spotifySongDisplay = '🎵\'{title}\' ᵇʸ {artist}🎶 『{song_progress}/{song_length}』'
spotifyAccessToken = ''
spotifyRefreshToken = ''
spotify_client_id = '915e1de141b3408eb430d25d0d39b380'
pulsoidToken = ''
usePulsoid = True
useHypeRate = False
hypeRateKey = 'FIrXkWWlf57iHjMu0x3lEMNst8IDIzwUA2UD6lmSxL4BqBUTYw8LCwQlM2n5U8RU' #<- my personal token that may or may not be working depending on how the hyperate gods are feeling today
hypeRateSessionId = ''
timeDisplayAM = "{hour}:{minute} AM"
timeDisplayPM = "{hour}:{minute} PM"
showSongInfo = True
useTimeParameters = False
removeParenthesis = False
###########Program Variables (not in conf)#########
previousSongTitle = '' #used to prevent song title from updating when not changed to allow tooltip to appear.
current_tab = 'layout'
code_verifier = '' #for manual code entry
layoutStorage = ''
layoutUpdate = '' #making sure the code for updating the layout editor only run when needed as opposed to every .1 seconds!
output = ''
textParseIterator = 0
msgOutput = ''
afk = False
songName = ''
tickCount = 2
hrConnected = False
heartRate = 0
windowAccess = None
playTime = 0
oscForewordPortMemory = ''
oscForewordAddressMemory = ''
runForewordServer = False
oscListenPortMemory = ''
oscListenAddressMemory = ''
isListenServerRunning = False
listenServer = None
useForewordMemory = False
isAfk = False
isVR = False #Never used as the game never actually updates vrmode (well, it does *sometimes*)
isMute = False
isInSeat = False
voiceVolume = 0
isUsingEarmuffs = False
isBooped= False
isPat = False
vrcPID = None
playTimeDat = time.mktime(time.localtime(psutil.Process(vrcPID).create_time()))
lastSent = ''
sentTime = 0
sendSkipped = False
spotifyAuthCode = None #<- only needed for the spotify linking process (temp var)
spotify_redirect_uri = 'http://localhost:8000/callback'
spotifyLinkStatus = 'Unlinked'
cancelLink = False
spotifyPlayState = ''
pulsoidLastUsed = True
hypeRateLastUsed = False
textStorage = ""
cpu_percent = 0
spotifySongUrl = 'https://spotify.com'
nameToReturn = ''
#check to see if code is already running
try:
me = singleton.SingleInstance() #also me (who's single)
except:
ctypes.windll.user32.MessageBoxW(None, u"OSC Chat Tools is already running!.", u"OCT is already running!", 16)
run = False
os._exit(0)
def fatal_error(error = None):
global run
run = False
ctypes.windll.user32.MessageBoxW(None, u"OSC Chat Tools has encountered a fatal error.", u"OCT Fatal Error", 16)
if error != None:
result = ctypes.windll.user32.MessageBoxW(None, u"The program crashed with an error message. Would you like to copy it to your clipboard?", u"OCT Fatal Error", 3 + 64)
if result == 6:
pyperclip.copy(str(datetime.now())+" ["+threading.current_thread().name+"] "+str(error))
result = ctypes.windll.user32.MessageBoxW(None, u"Open the github page to get support?", u"OCT Fatal Error", 3 + 64)
if result == 6:
webbrowser.open('https://github.com/Lioncat6/OSC-Chat-Tools/wiki/Fatal-Error-Crash')
time.sleep(5)
os._exit(0)
def afk_handler(unused_address, args):
global isAfk
isAfk = args
#print('isAfk', isAfk)
outputLog(f'isAfk {isAfk}')
def mute_handler(unused_address, args):
global isMute
isMute = args
#print('isMute',isMute)
outputLog(f'isMute {isMute}')
def inSeat_handler(unused_address, args):
global isInSeat
isInSeat = args
#print('isInSeat',isInSeat)
outputLog(f'isInSeat {isInSeat}')
def volume_handler(unused_address, args):
global voiceVolume
voiceVolume = args
#print('voiceVolume',voiceVolume)
#outputLog(f'voiceVolume {voiceVolume}')
def usingEarmuffs_handler(unused_address, args):
global isUsingEarmuffs
isUsingEarmuffs = args
#print('isUsingEarmuffs', isUsingEarmuffs)
outputLog(f'isUsingEarmuffs {isUsingEarmuffs}')
def vr_handler(unused_address, args):# The game never sends this value from what I've seen
global isVR
if args ==1:
isVR == True
else:
isVR == False
#print('isVR', isVR)
outputLog(f'isVR {isVR}')
"""def thread_exists(name):
for thread in threading.enumerate():
if thread.name == name:
return True
return False"""
def boop_handler(unused_address, args):
global isBooped
isBooped = args
outputLog(f'isBooped {isBooped}')
def pat_handler(unused_address, args):
global isPat
if isinstance(args, int) or isinstance(args, float):
if args > 0:
isPat = True
else:
isPat = False
else:
isPat = args
outputLog(f'isPat {isPat}')
message_queue = []
queue_lock = Lock()
def outputLog(text):
text = text.replace("\n", "\n ")
print(text)
global threadName
threadName = threading.current_thread().name
def outputQueue():
global threadName
timestamp = datetime.now()
with queue_lock:
message_queue.append((timestamp, "["+threadName+"] "+text))
while windowAccess is None:
time.sleep(.01)
with queue_lock:
message_queue.sort(key=lambda x: x[0])
for message in message_queue:
if logOutput:
with open('OCT_debug_log.txt', 'a+', encoding="utf-8") as f:
f.write("\n"+ str(message[0]) + " " + message[1])
windowAccess.write_event_value('outputSend', str(message[0]) + " " + message[1])
try:
windowAccess['output'].Widget.see('end')
except Exception as e:
if run:
pass
#fatal_error(e)
message_queue.clear()
outputQueueHandler = Thread(target=outputQueue)
outputQueueHandler.start()
outputLog("OCT Starting...")
try:
if not os.path.isfile('please-do-not-delete.txt'):
with open('please-do-not-delete.txt', 'w', encoding="utf-8") as f:
f.write('[]')
except Exception as e:
outputLog("Failed to create settings file "+str(e))
def update_checker(a):
global updatePrompt
global outOfDate
global windowAccess
global version
url = 'https://api.github.com/repos/Lioncat6/OSC-Chat-Tools/releases'
try:
response = requests.get(url)
if response.ok:
data = response.json()
if int(data[0]["tag_name"].replace('v', '').replace('.', '').replace(' ', '').replace('Version', '').replace('version', '')) != int(version.replace('v', '').replace('.', '').replace(' ', '').replace('Version', '').replace('version', '')):
#print("A new version is available! "+ data[0]["tag_name"].replace('v', '').replace(' ', '').replace('Version', '').replace('version', '')+" > " + version.replace('v', '').replace(' ', '').replace('Version', '').replace('version', ''))
outputLog("A new version is available! "+ data[0]["tag_name"].replace('v', '').replace(' ', '').replace('Version', '').replace('version', '')+" > " + version.replace('v', '').replace(' ', '').replace('Version', '').replace('version', ''))
if updatePrompt or a:
def updatePromptWaitThread():
while windowAccess == None:
time.sleep(.1)
pass
windowAccess.write_event_value('updateAvailable', data[0]["tag_name"].replace('v', '').replace(' ', '').replace('Version', '').replace('version', ''))
updatePromptWaitThreadHandler = Thread(target=updatePromptWaitThread).start()
outOfDate = True
def updatePromptWaitThread2():
while windowAccess == None:
time.sleep(.1)
pass
windowAccess.write_event_value('markOutOfDate', '')
updatePromptWaitThreadHandler2 = Thread(target=updatePromptWaitThread2).start()
else:
if a:
windowAccess.write_event_value('popup', "Program is up to date! Version "+version)
#print("Program is up to date! Version "+version)
outputLog("Program is up to date! Version "+version)
else:
#print('Update Checking Error occurred:', response.status_code)
outputLog('Update Checking Error occurred:', response.status_code)
except Exception as e:
outputLog('Update Checking Error occurred: '+ str(e))
async def get_media_info():
sessions = await MediaManager.request_async()
# This source_app_user_model_id check and if statement is optional
# Use it if you want to only get a certain player/program's media
# (e.g. only chrome.exe's media not any other program's).
# To get the ID, use a breakpoint() to run sessions.get_current_session()
# while the media you want to get is playing.
# Then set TARGET_ID to the string this call returns.
current_session = sessions.get_current_session()
if current_session: # there needs to be a media session running
info = await current_session.try_get_media_properties_async()
# song_attr[0] != '_' ignores system attributes
info_dict = {song_attr: info.__getattribute__(song_attr) for song_attr in dir(info) if song_attr[0] != '_'}
# converts winrt vector to list
info_dict['genres'] = list(info_dict['genres'])
return info_dict
# It could be possible to select a program from a list of current
# available ones. I just haven't implemented this here for my use case.
# See references for more information.
raise Exception('TARGET_PROGRAM is not the current media session')
async def getMediaSession():
sessions = await MediaManager.request_async()
session = sessions.get_current_session()
return session
def mediaIs(state):
session = asyncio.run(getMediaSession())
if session == None:
return False
return int(wmc.GlobalSystemMediaTransportControlsSessionPlaybackStatus[state]) == session.get_playback_info().playback_status
confDataDict = { #this dictionary will always exclude position 0 which is the config version!
"1.4.1" : ['confVersion', 'deprecated_topTextToggle', 'deprecated_topTimeToggle', 'deprecated_topSongToggle', 'deprecated_topCPUToggle', 'deprecated_topRAMToggle', 'deprecated_topNoneToggle', 'deprecated_bottomTextToggle', 'deprecated_deprecated_bottomTimeToggle', 'deprecated_bottomSongToggle', 'deprecated_bottomCPUToggle', 'deprecated_bottomRAMToggle', 'deprecated_bottomNoneToggle', 'message_delay', 'messageString', 'FileToRead', 'scrollText', 'hideSong', 'deprecated_hideMiddle', 'hideOutside', 'showPaused', 'songDisplay', 'showOnChange', 'songChangeTicks', 'minimizeOnStart', 'keybind_run', 'keybind_afk','topBar', 'middleBar', 'bottomBar', 'deprecated_topHRToggle', 'deprecated_bottomHRToggle', 'pulsoidToken', 'avatarHR', 'blinkOverride', 'blinkSpeed', 'useAfkKeybind', 'toggleBeat', 'updatePrompt'],
"1.4.20" : ['confVersion', 'deprecated_topTextToggle', 'deprecated_topTimeToggle', 'deprecated_topSongToggle', 'deprecated_topCPUToggle', 'deprecated_topRAMToggle', 'deprecated_topNoneToggle', 'deprecated_bottomTextToggle', 'deprecated_deprecated_bottomTimeToggle', 'deprecated_bottomSongToggle', 'deprecated_bottomCPUToggle', 'deprecated_bottomRAMToggle', 'deprecated_bottomNoneToggle', 'message_delay', 'messageString', 'FileToRead', 'scrollText', 'hideSong', 'deprecated_hideMiddle', 'hideOutside', 'showPaused', 'songDisplay', 'showOnChange', 'songChangeTicks', 'minimizeOnStart', 'keybind_run', 'keybind_afk','topBar', 'middleBar', 'bottomBar', 'deprecated_topHRToggle', 'deprecated_bottomHRToggle', 'pulsoidToken', 'avatarHR', 'blinkOverride', 'blinkSpeed', 'useAfkKeybind', 'toggleBeat', 'updatePrompt', 'oscListenAddress', 'oscListenPort', 'oscSendAddress', 'oscSendPort', 'oscForewordAddress', 'oscForeword', 'oscListen', 'oscForeword', 'logOutput'],
"1.5.0" : ['confVersion', 'message_delay', 'messageString', 'FileToRead', 'scrollText', 'hideSong', 'hideOutside', 'showPaused', 'songDisplay', 'showOnChange', 'songChangeTicks', 'minimizeOnStart', 'keybind_run', 'keybind_afk','topBar', 'middleBar', 'bottomBar', 'pulsoidToken', 'avatarHR', 'blinkOverride', 'blinkSpeed', 'useAfkKeybind', 'toggleBeat', 'updatePrompt', 'oscListenAddress', 'oscListenPort', 'oscSendAddress', 'oscSendPort', 'oscForewordAddress', 'oscForeword', 'oscListen', 'oscForeword', 'logOutput', 'layoutString', 'verticalDivider','cpuDisplay', 'ramDisplay', 'gpuDisplay', 'hrDisplay', 'playTimeDisplay', 'mutedDisplay', 'unmutedDisplay'],
"1.5.1" : ['confVersion', 'message_delay', 'messageString', 'FileToRead', 'scrollText', 'hideSong', 'hideOutside', 'showPaused', 'songDisplay', 'showOnChange', 'songChangeTicks', 'minimizeOnStart', 'keybind_run', 'keybind_afk','topBar', 'middleBar', 'bottomBar', 'pulsoidToken', 'avatarHR', 'blinkOverride', 'blinkSpeed', 'useAfkKeybind', 'toggleBeat', 'updatePrompt', 'oscListenAddress', 'oscListenPort', 'oscSendAddress', 'oscSendPort', 'oscForewordAddress', 'oscForeword', 'oscListen', 'oscForeword', 'logOutput', 'layoutString', 'verticalDivider','cpuDisplay', 'ramDisplay', 'gpuDisplay', 'hrDisplay', 'playTimeDisplay', 'mutedDisplay', 'unmutedDisplay', 'darkMode'],
"1.5.2" : ['confVersion', 'message_delay', 'messageString', 'FileToRead', 'scrollText', 'hideSong', 'hideOutside', 'showPaused', 'songDisplay', 'showOnChange', 'songChangeTicks', 'minimizeOnStart', 'keybind_run', 'keybind_afk','topBar', 'middleBar', 'bottomBar', 'pulsoidToken', 'avatarHR', 'blinkOverride', 'blinkSpeed', 'useAfkKeybind', 'toggleBeat', 'updatePrompt', 'oscListenAddress', 'oscListenPort', 'oscSendAddress', 'oscSendPort', 'oscForewordAddress', 'oscForeword', 'oscListen', 'oscForeword', 'logOutput', 'layoutString', 'verticalDivider','cpuDisplay', 'ramDisplay', 'gpuDisplay', 'hrDisplay', 'playTimeDisplay', 'mutedDisplay', 'unmutedDisplay', 'darkMode'],
"1.5.3" : ['confVersion', 'message_delay', 'messageString', 'FileToRead', 'scrollText', 'hideSong', 'hideOutside', 'showPaused', 'songDisplay', 'showOnChange', 'songChangeTicks', 'minimizeOnStart', 'keybind_run', 'keybind_afk','topBar', 'middleBar', 'bottomBar', 'pulsoidToken', 'avatarHR', 'blinkOverride', 'blinkSpeed', 'useAfkKeybind', 'toggleBeat', 'updatePrompt', 'oscListenAddress', 'oscListenPort', 'oscSendAddress', 'oscSendPort', 'oscForewordAddress', 'oscForeword', 'oscListen', 'oscForeword', 'logOutput', 'layoutString', 'verticalDivider','cpuDisplay', 'ramDisplay', 'gpuDisplay', 'hrDisplay', 'playTimeDisplay', 'mutedDisplay', 'unmutedDisplay', 'darkMode', 'sendBlank', 'suppressDuplicates', 'sendASAP'],
"1.5.4" : ['confVersion', 'message_delay', 'messageString', 'FileToRead', 'scrollText', 'hideSong', 'hideOutside', 'showPaused', 'songDisplay', 'showOnChange', 'songChangeTicks', 'minimizeOnStart', 'keybind_run', 'keybind_afk','topBar', 'middleBar', 'bottomBar', 'pulsoidToken', 'avatarHR', 'blinkOverride', 'blinkSpeed', 'useAfkKeybind', 'toggleBeat', 'updatePrompt', 'oscListenAddress', 'oscListenPort', 'oscSendAddress', 'oscSendPort', 'oscForewordAddress', 'oscForeword', 'oscListen', 'oscForeword', 'logOutput', 'layoutString', 'verticalDivider','cpuDisplay', 'ramDisplay', 'gpuDisplay', 'hrDisplay', 'playTimeDisplay', 'mutedDisplay', 'unmutedDisplay', 'darkMode', 'sendBlank', 'suppressDuplicates', 'sendASAP'],
"1.5.5" : ['confVersion', 'message_delay', 'messageString', 'FileToRead', 'scrollText', 'hideSong', 'hideOutside', 'showPaused', 'songDisplay', 'showOnChange', 'songChangeTicks', 'minimizeOnStart', 'keybind_run', 'keybind_afk','topBar', 'middleBar', 'bottomBar', 'pulsoidToken', 'avatarHR', 'blinkOverride', 'blinkSpeed', 'useAfkKeybind', 'toggleBeat', 'updatePrompt', 'oscListenAddress', 'oscListenPort', 'oscSendAddress', 'oscSendPort', 'oscForewordAddress', 'oscForeword', 'oscListen', 'oscForeword', 'logOutput', 'layoutString', 'verticalDivider','cpuDisplay', 'ramDisplay', 'gpuDisplay', 'hrDisplay', 'playTimeDisplay', 'mutedDisplay', 'unmutedDisplay', 'darkMode', 'sendBlank', 'suppressDuplicates', 'sendASAP', 'useMediaManager', 'useSpotifyApi', 'spotifySongDisplay', 'spotifyAccessToken', 'spotifyRefreshToken'],
"1.5.6" : ['confVersion', 'message_delay', 'messageString', 'FileToRead', 'scrollText', 'hideSong', 'hideOutside', 'showPaused', 'songDisplay', 'showOnChange', 'songChangeTicks', 'minimizeOnStart', 'keybind_run', 'keybind_afk','topBar', 'middleBar', 'bottomBar', 'pulsoidToken', 'avatarHR', 'blinkOverride', 'blinkSpeed', 'useAfkKeybind', 'toggleBeat', 'updatePrompt', 'oscListenAddress', 'oscListenPort', 'oscSendAddress', 'oscSendPort', 'oscForewordAddress', 'oscForeword', 'oscListen', 'oscForeword', 'logOutput', 'layoutString', 'verticalDivider','cpuDisplay', 'ramDisplay', 'gpuDisplay', 'hrDisplay', 'playTimeDisplay', 'mutedDisplay', 'unmutedDisplay', 'darkMode', 'sendBlank', 'suppressDuplicates', 'sendASAP', 'useMediaManager', 'useSpotifyApi', 'spotifySongDisplay', 'spotifyAccessToken', 'spotifyRefreshToken', 'usePulsoid', 'useHypeRate', 'hypeRateKey', 'hypeRateSessionId'],
"1.5.7" : ['confVersion', 'message_delay', 'messageString', 'FileToRead', 'scrollText', 'hideSong', 'hideOutside', 'showPaused', 'songDisplay', 'showOnChange', 'songChangeTicks', 'minimizeOnStart', 'keybind_run', 'keybind_afk','topBar', 'middleBar', 'bottomBar', 'pulsoidToken', 'avatarHR', 'blinkOverride', 'blinkSpeed', 'useAfkKeybind', 'toggleBeat', 'updatePrompt', 'oscListenAddress', 'oscListenPort', 'oscSendAddress', 'oscSendPort', 'oscForewordAddress', 'oscForeword', 'oscListen', 'oscForeword', 'logOutput', 'layoutString', 'verticalDivider','cpuDisplay', 'ramDisplay', 'gpuDisplay', 'hrDisplay', 'playTimeDisplay', 'mutedDisplay', 'unmutedDisplay', 'darkMode', 'sendBlank', 'suppressDuplicates', 'sendASAP', 'useMediaManager', 'useSpotifyApi', 'spotifySongDisplay', 'spotifyAccessToken', 'spotifyRefreshToken', 'usePulsoid', 'useHypeRate', 'hypeRateKey', 'hypeRateSessionId','timeDisplayPM', 'timeDisplayAM'],
"1.5.8" : ['confVersion', 'message_delay', 'messageString', 'FileToRead', 'scrollText', 'hideSong', 'hideOutside', 'showPaused', 'songDisplay', 'showOnChange', 'songChangeTicks', 'minimizeOnStart', 'keybind_run', 'keybind_afk','topBar', 'middleBar', 'bottomBar', 'pulsoidToken', 'avatarHR', 'blinkOverride', 'blinkSpeed', 'useAfkKeybind', 'toggleBeat', 'updatePrompt', 'oscListenAddress', 'oscListenPort', 'oscSendAddress', 'oscSendPort', 'oscForewordAddress', 'oscForeword', 'oscListen', 'oscForeword', 'logOutput', 'layoutString', 'verticalDivider','cpuDisplay', 'ramDisplay', 'gpuDisplay', 'hrDisplay', 'playTimeDisplay', 'mutedDisplay', 'unmutedDisplay', 'darkMode', 'sendBlank', 'suppressDuplicates', 'sendASAP', 'useMediaManager', 'useSpotifyApi', 'spotifySongDisplay', 'spotifyAccessToken', 'spotifyRefreshToken', 'usePulsoid', 'useHypeRate', 'hypeRateKey', 'hypeRateSessionId','timeDisplayPM', 'timeDisplayAM'],
"1.5.8.1" : ['confVersion', 'message_delay', 'messageString', 'FileToRead', 'scrollText', 'hideSong', 'hideOutside', 'showPaused', 'songDisplay', 'showOnChange', 'songChangeTicks', 'minimizeOnStart', 'keybind_run', 'keybind_afk','topBar', 'middleBar', 'bottomBar', 'pulsoidToken', 'avatarHR', 'blinkOverride', 'blinkSpeed', 'useAfkKeybind', 'toggleBeat', 'updatePrompt', 'oscListenAddress', 'oscListenPort', 'oscSendAddress', 'oscSendPort', 'oscForewordAddress', 'oscForeword', 'oscListen', 'oscForeword', 'logOutput', 'layoutString', 'verticalDivider','cpuDisplay', 'ramDisplay', 'gpuDisplay', 'hrDisplay', 'playTimeDisplay', 'mutedDisplay', 'unmutedDisplay', 'darkMode', 'sendBlank', 'suppressDuplicates', 'sendASAP', 'useMediaManager', 'useSpotifyApi', 'spotifySongDisplay', 'spotifyAccessToken', 'spotifyRefreshToken', 'usePulsoid', 'useHypeRate', 'hypeRateKey', 'hypeRateSessionId','timeDisplayPM', 'timeDisplayAM'],
"1.5.8.2" : ['confVersion', 'message_delay', 'messageString', 'FileToRead', 'scrollText', 'hideSong', 'hideOutside', 'showPaused', 'songDisplay', 'showOnChange', 'songChangeTicks', 'minimizeOnStart', 'keybind_run', 'keybind_afk','topBar', 'middleBar', 'bottomBar', 'pulsoidToken', 'avatarHR', 'blinkOverride', 'blinkSpeed', 'useAfkKeybind', 'toggleBeat', 'updatePrompt', 'oscListenAddress', 'oscListenPort', 'oscSendAddress', 'oscSendPort', 'oscForewordAddress', 'oscForeword', 'oscListen', 'oscForeword', 'logOutput', 'layoutString', 'verticalDivider','cpuDisplay', 'ramDisplay', 'gpuDisplay', 'hrDisplay', 'playTimeDisplay', 'mutedDisplay', 'unmutedDisplay', 'darkMode', 'sendBlank', 'suppressDuplicates', 'sendASAP', 'useMediaManager', 'useSpotifyApi', 'spotifySongDisplay', 'spotifyAccessToken', 'spotifyRefreshToken', 'usePulsoid', 'useHypeRate', 'hypeRateKey', 'hypeRateSessionId','timeDisplayPM', 'timeDisplayAM'],
"1.5.9" : ['confVersion', 'message_delay', 'messageString', 'FileToRead', 'scrollText', 'hideSong', 'hideOutside', 'showPaused', 'songDisplay', 'showOnChange', 'songChangeTicks', 'minimizeOnStart', 'keybind_run', 'keybind_afk','topBar', 'middleBar', 'bottomBar', 'pulsoidToken', 'avatarHR', 'blinkOverride', 'blinkSpeed', 'useAfkKeybind', 'toggleBeat', 'updatePrompt', 'oscListenAddress', 'oscListenPort', 'oscSendAddress', 'oscSendPort', 'oscForewordAddress', 'oscForeword', 'oscListen', 'oscForeword', 'logOutput', 'layoutString', 'verticalDivider','cpuDisplay', 'ramDisplay', 'gpuDisplay', 'hrDisplay', 'playTimeDisplay', 'mutedDisplay', 'unmutedDisplay', 'darkMode', 'sendBlank', 'suppressDuplicates', 'sendASAP', 'useMediaManager', 'useSpotifyApi', 'spotifySongDisplay', 'spotifyAccessToken', 'spotifyRefreshToken', 'usePulsoid', 'useHypeRate', 'hypeRateKey', 'hypeRateSessionId','timeDisplayPM', 'timeDisplayAM', 'showSongInfo'],
"1.5.9.1" : ['confVersion', 'message_delay', 'messageString', 'FileToRead', 'scrollText', 'hideSong', 'hideOutside', 'showPaused', 'songDisplay', 'showOnChange', 'songChangeTicks', 'minimizeOnStart', 'keybind_run', 'keybind_afk','topBar', 'middleBar', 'bottomBar', 'pulsoidToken', 'avatarHR', 'blinkOverride', 'blinkSpeed', 'useAfkKeybind', 'toggleBeat', 'updatePrompt', 'oscListenAddress', 'oscListenPort', 'oscSendAddress', 'oscSendPort', 'oscForewordAddress', 'oscForeword', 'oscListen', 'oscForeword', 'logOutput', 'layoutString', 'verticalDivider','cpuDisplay', 'ramDisplay', 'gpuDisplay', 'hrDisplay', 'playTimeDisplay', 'mutedDisplay', 'unmutedDisplay', 'darkMode', 'sendBlank', 'suppressDuplicates', 'sendASAP', 'useMediaManager', 'useSpotifyApi', 'spotifySongDisplay', 'spotifyAccessToken', 'spotifyRefreshToken', 'usePulsoid', 'useHypeRate', 'hypeRateKey', 'hypeRateSessionId','timeDisplayPM', 'timeDisplayAM', 'showSongInfo'],
"1.5.10" : ['confVersion', 'message_delay', 'messageString', 'FileToRead', 'scrollText', 'hideSong', 'hideOutside', 'showPaused', 'songDisplay', 'showOnChange', 'songChangeTicks', 'minimizeOnStart', 'keybind_run', 'keybind_afk','topBar', 'middleBar', 'bottomBar', 'pulsoidToken', 'avatarHR', 'blinkOverride', 'blinkSpeed', 'useAfkKeybind', 'toggleBeat', 'updatePrompt', 'oscListenAddress', 'oscListenPort', 'oscSendAddress', 'oscSendPort', 'oscForewordAddress', 'oscForeword', 'oscListen', 'oscForeword', 'logOutput', 'layoutString', 'verticalDivider','cpuDisplay', 'ramDisplay', 'gpuDisplay', 'hrDisplay', 'playTimeDisplay', 'mutedDisplay', 'unmutedDisplay', 'darkMode', 'sendBlank', 'suppressDuplicates', 'sendASAP', 'useMediaManager', 'useSpotifyApi', 'spotifySongDisplay', 'spotifyAccessToken', 'spotifyRefreshToken', 'usePulsoid', 'useHypeRate', 'hypeRateKey', 'hypeRateSessionId','timeDisplayPM', 'timeDisplayAM', 'showSongInfo'],
"1.5.11" : ['confVersion', 'message_delay', 'messageString', 'FileToRead', 'scrollText', 'hideSong', 'hideOutside', 'showPaused', 'songDisplay', 'showOnChange', 'songChangeTicks', 'minimizeOnStart', 'keybind_run', 'keybind_afk','topBar', 'middleBar', 'bottomBar', 'pulsoidToken', 'avatarHR', 'blinkOverride', 'blinkSpeed', 'useAfkKeybind', 'toggleBeat', 'updatePrompt', 'oscListenAddress', 'oscListenPort', 'oscSendAddress', 'oscSendPort', 'oscForewordAddress', 'oscForeword', 'oscListen', 'oscForeword', 'logOutput', 'layoutString', 'verticalDivider','cpuDisplay', 'ramDisplay', 'gpuDisplay', 'hrDisplay', 'playTimeDisplay', 'mutedDisplay', 'unmutedDisplay', 'darkMode', 'sendBlank', 'suppressDuplicates', 'sendASAP', 'useMediaManager', 'useSpotifyApi', 'spotifySongDisplay', 'spotifyAccessToken', 'spotifyRefreshToken', 'usePulsoid', 'useHypeRate', 'hypeRateKey', 'hypeRateSessionId','timeDisplayPM', 'timeDisplayAM', 'showSongInfo', 'spotify_client_id'],
"1.5.12" : ['confVersion', 'message_delay', 'messageString', 'FileToRead', 'scrollText', 'hideSong', 'hideOutside', 'showPaused', 'songDisplay', 'showOnChange', 'songChangeTicks', 'minimizeOnStart', 'keybind_run', 'keybind_afk','topBar', 'middleBar', 'bottomBar', 'pulsoidToken', 'avatarHR', 'blinkOverride', 'blinkSpeed', 'useAfkKeybind', 'toggleBeat', 'updatePrompt', 'oscListenAddress', 'oscListenPort', 'oscSendAddress', 'oscSendPort', 'oscForewordAddress', 'oscForeword', 'oscListen', 'oscForeword', 'logOutput', 'layoutString', 'verticalDivider','cpuDisplay', 'ramDisplay', 'gpuDisplay', 'hrDisplay', 'playTimeDisplay', 'mutedDisplay', 'unmutedDisplay', 'darkMode', 'sendBlank', 'suppressDuplicates', 'sendASAP', 'useMediaManager', 'useSpotifyApi', 'spotifySongDisplay', 'spotifyAccessToken', 'spotifyRefreshToken', 'usePulsoid', 'useHypeRate', 'hypeRateKey', 'hypeRateSessionId','timeDisplayPM', 'timeDisplayAM', 'showSongInfo', 'spotify_client_id', 'useTimeParameters'],
"1.5.13" : ['confVersion', 'message_delay', 'messageString', 'FileToRead', 'scrollText', 'hideSong', 'hideOutside', 'showPaused', 'songDisplay', 'showOnChange', 'songChangeTicks', 'minimizeOnStart', 'keybind_run', 'keybind_afk','topBar', 'middleBar', 'bottomBar', 'pulsoidToken', 'avatarHR', 'blinkOverride', 'blinkSpeed', 'useAfkKeybind', 'toggleBeat', 'updatePrompt', 'oscListenAddress', 'oscListenPort', 'oscSendAddress', 'oscSendPort', 'oscForewordAddress', 'oscForeword', 'oscListen', 'oscForeword', 'logOutput', 'layoutString', 'verticalDivider','cpuDisplay', 'ramDisplay', 'gpuDisplay', 'hrDisplay', 'playTimeDisplay', 'mutedDisplay', 'unmutedDisplay', 'darkMode', 'sendBlank', 'suppressDuplicates', 'sendASAP', 'useMediaManager', 'useSpotifyApi', 'spotifySongDisplay', 'spotifyAccessToken', 'spotifyRefreshToken', 'usePulsoid', 'useHypeRate', 'hypeRateKey', 'hypeRateSessionId','timeDisplayPM', 'timeDisplayAM', 'showSongInfo', 'spotify_client_id', 'useTimeParameters'],
"1.5.14" : ['confVersion', 'message_delay', 'messageString', 'FileToRead', 'scrollText', 'hideSong', 'hideOutside', 'showPaused', 'songDisplay', 'showOnChange', 'songChangeTicks', 'minimizeOnStart', 'keybind_run', 'keybind_afk','topBar', 'middleBar', 'bottomBar', 'pulsoidToken', 'avatarHR', 'blinkOverride', 'blinkSpeed', 'useAfkKeybind', 'toggleBeat', 'updatePrompt', 'oscListenAddress', 'oscListenPort', 'oscSendAddress', 'oscSendPort', 'oscForewordAddress', 'oscForeword', 'oscListen', 'oscForeword', 'logOutput', 'layoutString', 'verticalDivider','cpuDisplay', 'ramDisplay', 'gpuDisplay', 'hrDisplay', 'playTimeDisplay', 'mutedDisplay', 'unmutedDisplay', 'darkMode', 'sendBlank', 'suppressDuplicates', 'sendASAP', 'useMediaManager', 'useSpotifyApi', 'spotifySongDisplay', 'spotifyAccessToken', 'spotifyRefreshToken', 'usePulsoid', 'useHypeRate', 'hypeRateKey', 'hypeRateSessionId','timeDisplayPM', 'timeDisplayAM', 'showSongInfo', 'spotify_client_id', 'useTimeParameters'],
"1.5.15" : ['confVersion', 'message_delay', 'messageString', 'FileToRead', 'scrollText', 'hideSong', 'hideOutside', 'showPaused', 'songDisplay', 'showOnChange', 'songChangeTicks', 'minimizeOnStart', 'keybind_run', 'keybind_afk','topBar', 'middleBar', 'bottomBar', 'pulsoidToken', 'avatarHR', 'blinkOverride', 'blinkSpeed', 'useAfkKeybind', 'toggleBeat', 'updatePrompt', 'oscListenAddress', 'oscListenPort', 'oscSendAddress', 'oscSendPort', 'oscForewordAddress', 'oscForeword', 'oscListen', 'oscForeword', 'logOutput', 'layoutString', 'verticalDivider','cpuDisplay', 'ramDisplay', 'gpuDisplay', 'hrDisplay', 'playTimeDisplay', 'mutedDisplay', 'unmutedDisplay', 'darkMode', 'sendBlank', 'suppressDuplicates', 'sendASAP', 'useMediaManager', 'useSpotifyApi', 'spotifySongDisplay', 'spotifyAccessToken', 'spotifyRefreshToken', 'usePulsoid', 'useHypeRate', 'hypeRateKey', 'hypeRateSessionId','timeDisplayPM', 'timeDisplayAM', 'showSongInfo', 'spotify_client_id', 'useTimeParameters', 'removeParenthesis']
}
if os.path.isfile('please-do-not-delete.txt'):
with open('please-do-not-delete.txt', 'r', encoding="utf-8") as f:
try:
fixed_list = ast.literal_eval(f.read())
if type(fixed_list[0]) is str:
confVersion = fixed_list[0]
confLoaderIterator = 1
if len(fixed_list) != len(confDataDict[confVersion]):
raise Exception('Data list length mismatch')
for i, x in enumerate(confDataDict[confVersion]):
globals()[x] = fixed_list[i]
#print(f"{x} = {fixed_list[i]}")
#print("Successfully Loaded config file version "+fixed_list[0])
outputLog("Successfully Loaded config file version "+fixed_list[0])
else:
#print('Config file is Too Old! Not Updating Values...')
outputLog('Config file is Too Old! Not Updating Values...')
except Exception as e:
#print('Config File Load Error! Not Updating Values...')
outputLog('Config File Load Error! Not Updating Values...\n'+str(e))
if confVersion == "1.4.1" or confVersion == "1.4.20":
outputLog("Converting old layout system, please update your config by pressing apply!")
if deprecated_topTextToggle:
layoutString = layoutString + '{text(0)}'
if deprecated_topTimeToggle:
layoutString = layoutString + '{time(0)}'
if deprecated_topSongToggle:
layoutString = layoutString + '{song(0)}'
if deprecated_topCPUToggle:
layoutString = layoutString + '{cpu(0)}'
if deprecated_topRAMToggle:
layoutString = layoutString + '{ram(0)}'
if not deprecated_hideMiddle and (deprecated_topTextToggle or deprecated_topTimeToggle or deprecated_topSongToggle or deprecated_topCPUToggle or deprecated_topRAMToggle) and (deprecated_bottomTextToggle or deprecated_deprecated_bottomTimeToggle or deprecated_bottomSongToggle or deprecated_bottomCPUToggle or deprecated_bottomRAMToggle):
layoutString = layoutString + '{div(0)}'
if deprecated_bottomTextToggle:
layoutString = layoutString + '{text(0)}'
if deprecated_deprecated_bottomTimeToggle:
layoutString = layoutString + '{time(0)}'
if deprecated_bottomSongToggle:
layoutString = layoutString + '{song(0)}'
if deprecated_bottomCPUToggle:
layoutString = layoutString + '{cpu(0)}'
if deprecated_bottomRAMToggle:
layoutString = layoutString + '{ram(0)}'
forewordServerLastUsed = oscForeword
layoutDisplayDict = {
"playtime(" : "⌚Play Time",
"text(" : "💬Text",
"time(" : "🕒Time",
"song(" : "🎵Song",
"cpu(" : "⏱️CPU Usage",
"ram(" : "🚦RAM Usage",
"gpu(" : "⏳GPU Usage",
"hr(" : "💓Heart Rate",
"mute(" : "🔇Mute Status",
"stt(" : "⌨Speech To Text",
"div(" : "☵Divider"
}
def layoutPreviewBuilder(layout, window):
def returnDisp(a):
global layoutDisplayDict
for x in layoutDisplayDict:
if x in a:
return layoutDisplayDict[x]
try:
layoutList = ast.literal_eval("["+layout.replace("{", "\"").replace("}", "\",")[:-1]+"]")
layoutLen = len(layoutList)
if layoutLen <=15:
for x in range(layoutLen+1, 16):
window['layout'+str(x)].update(visible=False)
if layoutLen > 0:
for x in range(1, layoutLen+1):
window['layout'+str(x)].update(visible=True)
window['text'+str(x)].update(value=returnDisp(layoutList[x-1]))
if "3" in layoutList[x-1]:
window['divider'+str(x)].update(value=True)
window['newLine'+str(x)].update(value=True)
elif "2" in layoutList[x-1]:
window['newLine'+str(x)].update(value=True)
window['divider'+str(x)].update(value=False)
elif "1" in layoutList[x-1]:
window['divider'+str(x)].update(value=True)
window['newLine'+str(x)].update(value=False)
else:
window['divider'+str(x)].update(value=False)
window['newLine'+str(x)].update(value=False)
else:
for x in range(1, 16):
window['layout'+str(x)].update(visible=False)
except:
for x in range(1, 16):
window['layout'+str(x)].update(visible=False)
def refreshAccessToken(oldRefreshToken):
global spotifyRefreshToken
global spotifyAccessToken
global spotify_client_id
token_url = 'https://accounts.spotify.com/api/token'
data = {
'grant_type': 'refresh_token',
'refresh_token': oldRefreshToken,
'client_id': spotify_client_id
}
response = requests.post(token_url, data=data)
if response.status_code != 200:
raise Exception('AccessToken refresh error... '+str(response.json()))
#print(response.json())
spotifyRefreshToken = response.json().get('refresh_token')
spotifyAccessToken = response.json().get('access_token')
def getSpotifyPlaystate():
global spotifySongUrl
global spotifyRefreshToken
global spotifyAccessToken
def get_playstate(accessToken):
global spotifyRefreshToken
global spotifyAccessToken
#print(spotifyAccessToken)
#print(accessToken)
headers = {
'Authorization': 'Bearer ' + accessToken,
}
response = requests.get('https://api.spotify.com/v1/me/player', headers=headers)
if response.status_code == 204:
data = ''
else:
data = response.json()
return data
try:
playState = get_playstate(spotifyAccessToken)
if playState != '' and playState != None:
if 'error' in str(playState):
raise Exception(str(playState))
except Exception as e:
if "expired" in str(e):
outputLog("Attempting to regenerate outdated access token...\nReason: "+str(e))
refreshAccessToken(spotifyRefreshToken)
def waitThread():
while windowAccess == None:
time.sleep(.1)
pass
windowAccess.write_event_value('Apply', '')
waitThreadHandler = Thread(target=waitThread).start()
playState = get_playstate(spotifyAccessToken)
else:
outputLog("Spotify connection error... retrying\nFull Error: "+str(e))
playState = get_playstate(spotifyAccessToken)
if playState == None:
playState = ''
return playState
def loadSpotifyTokens():
global spotifyLinkStatus
outputLog("Loading spotify tokens...")
def get_profile(accessToken):
headers = {
'Authorization': 'Bearer ' + accessToken,
}
response = requests.get('https://api.spotify.com/v1/me', headers=headers)
data = response.json()
if response.status_code != 200:
raise Exception(response.json())
return data
try:
outputLog("Trying old access token...")
profile = get_profile(spotifyAccessToken)
except Exception as e:
outputLog("Attempting to regenerate outdated access token...\nReason: "+str(e))
refreshAccessToken(spotifyRefreshToken)
profile = get_profile(spotifyAccessToken)
linkedUserName = profile.get('display_name')
outputLog("Spotify linked to "+linkedUserName+" successfully!")
spotifyLinkStatus = 'Linked to '+linkedUserName
try:
if spotifyAccessToken != '' and spotifyAccessToken != None:
loadSpotifyTokens()
except Exception as e:
if "timed out" in str(e):
outputLog('Spotify API Timed out... tokens may be invalid\nFull Error: '+str(e))
spotifyLinkStatus = 'Status Unknown'
elif "Max retries" in str(e) or "aborted" in str(e):
outputLog('Spotify API connection error... tokens may be invalid. Are you connected to the internet?\nFull Error: '+str(e))
spotifyLinkStatus = 'Status Unknown'
else:
spotifyLinkStatus = 'Error - Please Relink!'
spotifyAccessToken = ''
spotifyRefreshToken = ''
outputLog("Spotify token load error! Please relink!\nFull Error: "+str(e))
def uiThread():
global fontColor
global bgColor
global accentColor
global scrollbarColor
global buttonColor
global scrollbarBackgroundColor
global tabBackgroundColor
global tabTextColor
global current_tab
global version
global msgOutput
global message_delay
global messageString
global playMsg
global run
global afk
global FileToRead
global scrollText
global hideSong
global deprecated_hideMiddle
global hideOutside
global showPaused
global songDisplay
global songName
global showOnChange
global songChangeTicks
global minimizeOnStart
global keybind_run
global keybind_afk
global topBar
global middleBar
global bottomBar
global pulsoidToken
global windowAccess
global avatarHR
global blinkOverride
global blinkSpeed
global useAfkKeybind
global toggleBeat
global updatePrompt
global outOfDate
global confVersion
global oscListenAddress
global oscListenPort
global oscSendAddress
global oscSendPort
global oscForewordAddress
global oscForewordPort
global oscListen
global oscForeword
global logOutput
global layoutString
global verticalDivider
global layoutDisplayDict
global cpuDisplay
global ramDisplay
global gpuDisplay
global hrDisplay
global playTimeDisplay
global mutedDisplay
global unmutedDisplay
global darkMode
global sendBlank
global suppressDuplicates
global sendASAP
global timeDisplayAM
global timeDisplayPM
global useMediaManager
global useSpotifyApi
global spotifySongDisplay
global spotifyAccessToken
global spotifyRefreshToken
global cancelLink
global spotifyLinkStatus
global spotify_client_id
global usePulsoid
global useHypeRate
global hypeRateKey
global hypeRateSessionId
global showSongInfo
global useTimeParameters
global removeParenthesis
global previousSongTitle
if darkMode:
bgColor = '#333333'
accentColor = '#4d4d4d'
fontColor = 'grey85'
buttonColor = accentColor
scrollbarColor = accentColor
scrollbarBackgroundColor = accentColor
tabBackgroundColor = accentColor
tabTextColor = fontColor
else:
bgColor = '#64778d'
accentColor = '#528b8b'
fontColor = 'white'
buttonColor = '#283b5b'
scrollbarColor = '#283b5b'
scrollbarBackgroundColor = '#a6b2be'
tabBackgroundColor = 'white'
tabTextColor = 'black'
sg.set_options(sbar_frame_color=fontColor)
sg.set_options(scrollbar_color=scrollbarColor)
sg.set_options(button_color=(fontColor, buttonColor))
sg.set_options(text_color=fontColor)
sg.set_options(background_color=bgColor)
sg.set_options(element_background_color=bgColor)
sg.set_options(text_element_background_color=bgColor)
sg.set_options(sbar_trough_color=scrollbarBackgroundColor)
sg.set_options(border_width=0)
sg.set_options(use_ttk_buttons=True)
sg.set_options(input_elements_background_color=fontColor)
new_layout_layout = [[sg.Column(
[[sg.Text('Configure chatbox layout', background_color=accentColor, font=('Arial', 12, 'bold')), sg.Checkbox('Text file read - defined in the behavior tab\n(This will disable everything else)', default=False, key='scroll', enable_events= True, background_color='dark slate blue')],
[sg.Column([
[sg.Text('Add Elements', font=('Arial', 12, 'bold'))],
[sg.Text('Every Element is customizable from the Behavior Tab', font=('Arial', 10, 'bold'))],
[sg.Text('*', text_color='cyan', font=('Arial', 12, 'bold'), pad=(0, 0)), sg.Text('= Requires OSC Listening To Function')],
[sg.Text('💬Text', font=('Arial', 12, 'bold')), sg.Push(), sg.Text('A configurable text object', ), sg.Push(), sg.Button('Add to Layout', key='addText')],
[sg.Text('🕒Time', font=('Arial', 12, 'bold')), sg.Push(), sg.Text('Display your current time', ), sg.Push(), sg.Button('Add to Layout', key='addTime')],
[sg.Text('🎵Song', font=('Arial', 12, 'bold')), sg.Push(), sg.Text('Customizable song display', ), sg.Push(), sg.Button('Add to Layout', key='addSong')],
[sg.Text('⏱️CPU', font=('Arial', 12, 'bold')), sg.Push(), sg.Text('Display CPU Utilization %', ), sg.Push(), sg.Button('Add to Layout', key='addCPU')],
[sg.Text('🚦RAM', font=('Arial', 12, 'bold')), sg.Push(), sg.Text('Display RAM Usage %', ), sg.Push(), sg.Button('Add to Layout', key='addRAM')],
[sg.Text('⏳GPU', font=('Arial', 12, 'bold')), sg.Push(), sg.Text('Display GPU Utilization %', ), sg.Push(), sg.Button('Add to Layout', key='addGPU')],
[sg.Text('💓HR', font=('Arial', 12, 'bold')), sg.Push(), sg.Text('Display Heart Rate', ), sg.Push(), sg.Button('Add to Layout', key='addHR')],
[sg.Text('🔇Mute', font=('Arial', 12, 'bold')), sg.Text('*', text_color='cyan', pad=(0, 0), font=('Arial', 12, 'bold')), sg.Push(), sg.Text('Display Mic Mute Status', ), sg.Push(), sg.Button('Add to Layout', key='addMute')],
[sg.Text('⌚Play Time', font=('Arial', 12, 'bold')), sg.Push(), sg.Text('Show Play Time', ), sg.Push(), sg.Button('Add to Layout', key='addPlaytime')],
[sg.Text('⌨️STT', font=('Arial', 12, 'bold')), sg.Push(), sg.Text('Speech recognition object', ), sg.Push(), sg.Button('Coming Soon', disabled=True, key='addSTT')],
[sg.Text('☵Divider', font=('Arial', 12, 'bold')), sg.Push(), sg.Text('Horizontal Divider', ), sg.Push(), sg.Button('Add to Layout', key='addDiv')],
],size=(350, 520), scrollable=True, vertical_scroll_only=True, element_justification='center'), sg.Column([
[sg.Text('Arrange Elements', font=('Arial', 12, 'bold'))],
[sg.Text('➥ = New Line ┋ = Vertical Divider')],
[sg.Column([
[sg.Column([[sg.Button('❌', key='delete1'), sg.Button('⬆️', disabled=True, key='up1'), sg.Button('⬇️', key='down1'), sg.Text('---', key='text1', font=('Arial', 10, 'bold')), sg.Checkbox('┋', key="divider1", enable_events=True, font=('Arial', 10, 'bold')), sg.Checkbox('➥', enable_events=True, key="newLine1")]], key='layout1', element_justification='left')],
[sg.Column([[sg.Button('❌', key='delete2'), sg.Button('⬆️', key='up2'), sg.Button('⬇️', key='down2'), sg.Text('---', key='text2', font=('Arial', 10, 'bold')), sg.Checkbox('┋', enable_events=True, key="divider2", font=('Arial', 10, 'bold')), sg.Checkbox('➥', enable_events=True, key="newLine2")]], key='layout2', element_justification='left')],
[sg.Column([[sg.Button('❌', key='delete3'), sg.Button('⬆️', key='up3'), sg.Button('⬇️', key='down3'), sg.Text('---', key='text3', font=('Arial', 10, 'bold')), sg.Checkbox('┋', enable_events=True, key="divider3", font=('Arial', 10, 'bold')), sg.Checkbox('➥', enable_events=True, key="newLine3")]], key='layout3', element_justification='left')],
[sg.Column([[sg.Button('❌', key='delete4'), sg.Button('⬆️', key='up4'), sg.Button('⬇️', key='down4'), sg.Text('---', key='text4', font=('Arial', 10, 'bold')), sg.Checkbox('┋', enable_events=True, key="divider4", font=('Arial', 10, 'bold')), sg.Checkbox('➥', enable_events=True, key="newLine4")]], key='layout4', element_justification='left')],
[sg.Column([[sg.Button('❌', key='delete5'), sg.Button('⬆️', key='up5'), sg.Button('⬇️', key='down5'), sg.Text('---', key='text5', font=('Arial', 10, 'bold')), sg.Checkbox('┋', enable_events=True, key="divider5", font=('Arial', 10, 'bold')), sg.Checkbox('➥', enable_events=True, key="newLine5")]], key='layout5', element_justification='left')],
[sg.Column([[sg.Button('❌', key='delete6'), sg.Button('⬆️', key='up6'), sg.Button('⬇️', key='down6'), sg.Text('---', key='text6', font=('Arial', 10, 'bold')), sg.Checkbox('┋', enable_events=True, key="divider6", font=('Arial', 10, 'bold')), sg.Checkbox('➥', enable_events=True, key="newLine6")]], key='layout6', element_justification='left')],
[sg.Column([[sg.Button('❌', key='delete7'), sg.Button('⬆️', key='up7'), sg.Button('⬇️', key='down7'), sg.Text('---', key='text7', font=('Arial', 10, 'bold')), sg.Checkbox('┋', enable_events=True, key="divider7", font=('Arial', 10, 'bold')), sg.Checkbox('➥', enable_events=True, key="newLine7")]], key='layout7', element_justification='left')],
[sg.Column([[sg.Button('❌', key='delete8'), sg.Button('⬆️', key='up8'), sg.Button('⬇️', key='down8'), sg.Text('---', key='text8', font=('Arial', 10, 'bold')), sg.Checkbox('┋', enable_events=True, key="divider8", font=('Arial', 10, 'bold')), sg.Checkbox('➥', enable_events=True, key="newLine8")]], key='layout8', element_justification='left')],
[sg.Column([[sg.Button('❌', key='delete9'), sg.Button('⬆️', key='up9'), sg.Button('⬇️', key='down9'), sg.Text('---', key='text9', font=('Arial', 10, 'bold')), sg.Checkbox('┋', enable_events=True, key="divider9", font=('Arial', 10, 'bold')), sg.Checkbox('➥', enable_events=True, key="newLine9")]], key='layout9', element_justification='left')],
[sg.Column([[sg.Button('❌', key='delete10'), sg.Button('⬆️', key='up10'), sg.Button('⬇️', key='down10'), sg.Text('---', key='text10', font=('Arial', 10, 'bold')), sg.Checkbox('┋', enable_events=True, key="divider10", font=('Arial', 10, 'bold')), sg.Checkbox('➥', enable_events=True, key="newLine10")]], key='layout10', element_justification='left')],
[sg.Column([[sg.Button('❌', key='delete11'), sg.Button('⬆️', key='up11'), sg.Button('⬇️', key='down11'), sg.Text('---', key='text11', font=('Arial', 10, 'bold')), sg.Checkbox('┋', enable_events=True, key="divider11", font=('Arial', 10, 'bold')), sg.Checkbox('➥', enable_events=True, key="newLine11")]], key='layout11', element_justification='left')],
[sg.Column([[sg.Button('❌', key='delete12'), sg.Button('⬆️', key='up12'), sg.Button('⬇️', key='down12'), sg.Text('---', key='text12', font=('Arial', 10, 'bold')), sg.Checkbox('┋', enable_events=True, key="divider12", font=('Arial', 10, 'bold')), sg.Checkbox('➥', enable_events=True, key="newLine12")]], key='layout12', element_justification='left')],
[sg.Column([[sg.Button('❌', key='delete13'), sg.Button('⬆️', key='up13'), sg.Button('⬇️', key='down13'), sg.Text('---', key='text13', font=('Arial', 10, 'bold')), sg.Checkbox('┋', enable_events=True, key="divider13", font=('Arial', 10, 'bold')), sg.Checkbox('➥', enable_events=True, key="newLine13")]], key='layout13', element_justification='left')],
[sg.Column([[sg.Button('❌', key='delete14'), sg.Button('⬆️', key='up14'), sg.Button('⬇️', key='down14'), sg.Text('---', key='text14', font=('Arial', 10, 'bold')), sg.Checkbox('┋', enable_events=True, key="divider14", font=('Arial', 10, 'bold')), sg.Checkbox('➥', enable_events=True, key="newLine14")]], key='layout14', element_justification='left')],
[sg.Column([[sg.Button('❌', key='delete15'), sg.Button('⬆️', key='up15'), sg.Button('⬇️', key='down15'), sg.Text('---', key='text15', font=('Arial', 10, 'bold')), sg.Checkbox('┋', enable_events=True, key="divider15", font=('Arial', 10, 'bold')), sg.Checkbox('➥', enable_events=True, key="newLine15")]], key='layout15', element_justification='left')],
], key="layout_editor", scrollable=True, vertical_scroll_only=True, element_justification='left', size=(335, 300))],
[sg.Text('Manual Edit', font=('Arial', 12, 'bold')), sg.Button('?', font=('Arial', 12, 'bold'), key="manualHelp")],
[sg.Text('Wrap object in { }. Spaces are respected.')],
[sg.Multiline('', key='layoutStorage', size=(45, 5), font=('Arial', 10, 'bold'))]
], size=(360, 520), element_justification='center')]
]
, expand_x=True, expand_y=True, background_color=accentColor, element_justification='left')]]
misc_conf_layout = [
[sg.Column([
[sg.Text('File to use for the text file read functionality')],
[sg.Button('Open File'), sg.Text('', key='message_file_path_display')]
], size=(379, 70))],
[sg.Column([
[sg.Text('Delay between frame updates, in seconds')],
[sg.Text('If you are getting a \'Timed out for x seconds\' message,\ntry adjusting this')],
[sg.Slider(range=(1.5, 10), default_value=1.5, resolution=0.1, orientation='horizontal', size=(40, 15), key="msgDelay", trough_color=scrollbarBackgroundColor)]
], size=(379, 110))],
[sg.Column([
[sg.Text('Advanced Sending Options')],
[sg.Checkbox('Clear the chatbox when toggled or on program close\nTurn off if you are getting issues with the chatbox blinking', key='sendBlank', default=True)],
[sg.Checkbox('Skip sending duplicate messages', key='suppressDuplicates', default=False)],
[sg.Checkbox('Send next message as soon as any data is updated\nOnly skips delay if previous message was skipped', key='sendASAP', default=False)]
], size=(379, 155))]
]
text_conf_layout = [
[sg.Column([
[sg.Text('Text to display for the message. One frame per line\nTo send a blank frame, use an asterisk(*) by itself on a line.\n\\n and \\v are respected.', justification='center')],
[sg.Multiline(default_text='OSC Chat Tools\nBy Lioncat6',
size=(50, 10), key='messageInput')]
], size=(379, 240))],
]
time_conf_layout = [
[sg.Column([
[sg.Text('Template to use for Time display\nVariables:{hour}, {minute}, {time_zone}, {hour24}')],
[sg.Text('AM:'), sg.Push(), sg.Input(key='timeDisplayAM', size=(30, 1))],
[sg.Text('PM:'), sg.Push(), sg.Input(key='timeDisplayPM', size=(30, 1))],
[sg.Checkbox('Send Time parameters to avatar (Uses vrcosc parameters)', default=False, key='useTimeParameters')]
], size=(379, 130))],
]
song_conf_layout = [[sg.Column([
[sg.Column([
[sg.Text("Select audio info source:")],
[sg.Checkbox("Windows Now Playing", key='useMediaManager', default=True, enable_events=True), sg.Checkbox("Spotify API", key='useSpotifyApi', default=False, enable_events=True)], #Its called the Now Playing Session Manager btw
], size=(379, 80))],
[sg.Column([
[sg.Text("Windows Now Playing settings:")],
[sg.Text('Template to use for song display.\nVariables: {artist}, {title}, {album_title}, {album_artist}')],
[sg.Input(key='songDisplay', size=(50, 1))]
], size=(379, 100))],
[sg.Column([
[sg.Text("Spotify settings:")],
[sg.Text('Template to use for song display.\nVariables: {artist}, {title}, {album_title}, {album_artist}, \n{song_progress}, {song_length}, {volume}, {song_id}')],
[sg.Input(key='spotifySongDisplay', size=(50, 1))],
[sg.Text('Spotify Client ID'), sg.Button("?", key='client_id_help', font='bold'), sg.Text('<- If linking fails, click here!', font="bold")],
[sg.Input(key='spotify_client_id', size=(50, 1))],
[sg.Button("Link Spotify 🔗", key="linkSpotify", button_color="#00a828", font="System"), sg.Text('Unlinked', key='spotifyLinkStatus', font="System", text_color='orange')],
], size=(379, 195))],
[sg.Column([
[sg.Text('Music Settings:')],
[sg.Checkbox('Show \"⏸️\" after song when song is paused', default=True, key='showPaused', enable_events= True)],
[sg.Checkbox('Hide song when music is paused', default=False, key='hideSong', enable_events= True)],
[sg.Checkbox('Remove text inside parenthesis; Shortens song names', default=False, key='removeParenthesis', enable_events= True)],
[sg.HorizontalSeparator()],
[sg.Checkbox('Only show music on song change', default=False, key='showOnChange', enable_events=True)],
[sg.Text('Amount of frames to wait before the song name disappears')],
[sg.Slider(range=(1, 5), default_value=2, resolution=1, orientation='horizontal', size=(40, 15), key="songChangeTicks", trough_color=scrollbarBackgroundColor)]
], size=(379, 220))],
], background_color=accentColor, scrollable=True, vertical_scroll_only=True, expand_x=True, expand_y=True, size=(440, 300),)]]
cpu_conf_layout = [
[sg.Column([
[sg.Text('Template to use for CPU display.\nVariables: {cpu_percent}')],
[sg.Input(key='cpuDisplay', size=(50, 1))]
], size=(379, 80))],
]
ram_conf_layout = [
[sg.Column([
[sg.Text('Template to use for RAM display. Variables:\n{ram_percent}, {ram_available}, {ram_total}, {ram_used}')],
[sg.Input(key='ramDisplay', size=(50, 1))]
], size=(379, 80))],
]
gpu_conf_layout = [
[sg.Column([
[sg.Text('Template to use for GPU display.\nVariables: {gpu_percent}')],
[sg.Input(key='gpuDisplay', size=(50, 1))]
], size=(379, 80))],
]
hr_conf_layout = [
[sg.Column([
[sg.Text('Template to use for Heart Rate display.\nVariables: {hr}')],
[sg.Input(key='hrDisplay', size=(50, 1))]
], size=(379, 80))],
[sg.Column([
[sg.Text('Heartrate Settings:')],
[sg.Text("Select heart rate data source:")],
[sg.Checkbox("Pulsoid", key='usePulsoid', default=True, enable_events=True), sg.Checkbox("HypeRate", key='useHypeRate', default=False, enable_events=True)],
[sg.Checkbox('Pass through heartrate avatar parameters\neven when not running', default=False, key='avatarHR', enable_events= True)],
[sg.Checkbox('Heart Rate Beat', default=True, key='toggleBeat', enable_events=True)],
[sg.Checkbox('Override Beat', default=False, key='blinkOverride', enable_events=True)],
[sg.Text('Blink Speed (If Overridden)')],
[sg.Slider(range=(0, 5), default_value=.5, resolution=.01, orientation='horizontal', size=(40, 15), key="blinkSpeed", trough_color=scrollbarBackgroundColor)]
], size=(379, 250))],
[sg.Column([
[sg.Text('Pulsoid Settings:')],
[sg.Text('Pulsoid Token:'), sg.Button('Get Token 💓', key='getPulsoidToken', font="System", button_color="#f92f60")],
[sg.Input(key='pulsoidToken', size=(50, 1))],
], size=(379, 90))],
[sg.Column([
[sg.Text('HypeRate Settings:')],
[sg.Text('HypeRate API Key:'), sg.Button('Get Key 💞', key='getHypeRateKey', font="System", button_color="#f92f60")],
[sg.Input(key='hypeRateKey', size=(50, 1))],
[sg.Text('HypeRate Session ID:'),],
[sg.Input(key='hypeRateSessionId', size=(50, 1))],
], size=(379, 130))]
]
playTime_conf_layout = [
[sg.Column([
[sg.Text('Template to use for Play Time display.\nVariables: {hours}, {remainder_minutes}, {minutes}')],
[sg.Input(key='playTimeDisplay', size=(50, 1))]
], size=(379, 80))],
]
mute_conf_layout = [
[sg.Column([
[sg.Text('Template to use for Mute Toggle display')],
[sg.Text('Muted:'), sg.Push(), sg.Input(key='mutedDisplay', size=(30, 1))],
[sg.Text('Unmuted:'), sg.Push(), sg.Input(key='unmutedDisplay', size=(30, 1))]
], size=(379, 80))],
]
divider_conf_layout = [
[sg.Column([
[sg.Text('Divider Settings:')],
[sg.Text('Top Divider:')],
[sg.Input(key='topBar', size=(50, 1))],
[sg.Text('Middle Divider:')],
[sg.Input(key='middleBar', size=(50, 1))],
[sg.Text('Bottom Divider:')],
[sg.Input(key='bottomBar', size=(50, 1))],
[sg.Text('Vertical Divider:')],
[sg.Input(key='verticalDivider', size=(50, 1))],
[sg.Checkbox('Remove outside dividers', default=True, key='hideOutside', enable_events= True)],
], size=(379, 270))],
]
new_behavior_layout = [
[
sg.TabGroup([[
sg.Tab('❔Misc.', [[sg.Column(misc_conf_layout, background_color=accentColor, scrollable=True, vertical_scroll_only=True, expand_x=True, expand_y=True, size=(440, 300),)]], background_color=accentColor),
sg.Tab('💬Text', [[sg.Column(text_conf_layout, background_color=accentColor, scrollable=True, vertical_scroll_only=True, expand_x=True, expand_y=True, size=(440, 300),)]], background_color=accentColor),
sg.Tab('🕒Time', [[sg.Column(time_conf_layout, background_color=accentColor, scrollable=True, vertical_scroll_only=True, expand_x=True, expand_y=True, size=(440, 300),)]], background_color=accentColor),
sg.Tab('🎵Song', song_conf_layout, background_color=accentColor),
sg.Tab('⏱️CPU', [[sg.Column(cpu_conf_layout, background_color=accentColor, scrollable=True, vertical_scroll_only=True, expand_x=True, expand_y=True, size=(440, 300),)]], background_color=accentColor),
sg.Tab('🚦RAM', [[sg.Column(ram_conf_layout, background_color=accentColor, scrollable=True, vertical_scroll_only=True, expand_x=True, expand_y=True, size=(440, 300),)]], background_color=accentColor),
sg.Tab('⏳GPU', [[sg.Column(gpu_conf_layout, background_color=accentColor, scrollable=True, vertical_scroll_only=True, expand_x=True, expand_y=True, size=(440, 300),)]], background_color=accentColor),
sg.Tab('💓HR', [[sg.Column(hr_conf_layout, background_color=accentColor, scrollable=True, vertical_scroll_only=True, expand_x=True, expand_y=True, size=(440, 300),)]], background_color=accentColor),
sg.Tab('🔇Mute', [[sg.Column(mute_conf_layout, background_color=accentColor, scrollable=True, vertical_scroll_only=True, expand_x=True, expand_y=True, size=(440, 300),)]], background_color=accentColor),
sg.Tab('⌚Play Time', [[sg.Column(playTime_conf_layout, background_color=accentColor, scrollable=True, vertical_scroll_only=True, expand_x=True, expand_y=True, size=(440, 300),)]], background_color=accentColor),
sg.Tab('⌨STT', [[sg.Text('Coming Soon')]]),
sg.Tab('☵Divider', [[sg.Column(divider_conf_layout, background_color=accentColor, scrollable=True, vertical_scroll_only=True, expand_x=True, expand_y=True, size=(440, 300),)]], background_color=accentColor),
]],
key='behaviorTabs', selected_title_color='white', selected_background_color='gray', expand_x=True, expand_y=True, size=(440, 300), font=('Arial', 11, 'normal'), tab_background_color=tabBackgroundColor, tab_border_width=0, title_color=tabTextColor,
)
],
]
"""behavior_layout = [[sg.Column([
[sg.Text('Configure chatbox behavior', background_color=accentColor, font=('Arial', 12, 'bold'))],
[sg.Column(text_conf_layout, background_color=accentColor)],
[sg.Column(time_conf_layout, background_color=accentColor)],
[sg.Column(misc_conf_layout, background_color=accentColor)],
[sg.Column(song_conf_layout, background_color=accentColor)],
[sg.Column(cpu_conf_layout, background_color=accentColor)],
[sg.Column(ram_conf_layout, background_color=accentColor)],
[sg.Column(gpu_conf_layout, background_color=accentColor)],
[sg.Column(hr_conf_layout, background_color=accentColor)],
[sg.Column(playTime_conf_layout, background_color=accentColor)],
[sg.Column(mute_conf_layout, background_color=accentColor)],
[sg.Column(divider_conf_layout, background_color=accentColor)],
]
, scrollable=True, vertical_scroll_only=True, expand_x=True, expand_y=True, background_color=accentColor)]]"""
keybindings_layout = [[sg.Column(
[
]
, scrollable=True, vertical_scroll_only=True, expand_x=True, expand_y=True, background_color=accentColor)]]
options_layout = [[sg.Column(
[[sg.Text('Configure Program', background_color=accentColor, font=('Arial', 12, 'bold'))],
[sg.Column([
[sg.Checkbox('Minimize on startup', default=False, key='minimizeOnStart', enable_events= True)],
[sg.Checkbox('Show update prompt', default=True, key='updatePrompt', enable_events= True)],
[sg.Checkbox('Dark Mode (applies on restart)', default=False, key='darkMode', enable_events=True)],
[sg.Checkbox('Show song info on bottom ribbon', default=True, key ='showSongInfo')]
], size=(379, 115))],
[sg.Text('Keybindings Configuration', background_color=accentColor, font=('Arial', 12, 'bold'))],
[sg.Text('You must press Apply for new keybinds to take affect!', background_color=accentColor)],
[sg.Column([
[sg.Text('Toggle Run'), sg.Frame('',[[sg.Text('Unbound', key='keybind_run', background_color=accentColor, pad=(10, 0))]],background_color=accentColor), sg.Button('Bind Key', key='run_binding')],
[sg.Checkbox('Use keybind', default=True, enable_events=True, key='useRunKeybind', disabled=True)],
[sg.Text('Toggle Afk'), sg.Frame('',[[sg.Text('Unbound', key='keybind_afk', background_color=accentColor, pad=(10, 0))]],background_color=accentColor), sg.Button('Bind Key', key='afk_binding')],
[sg.Checkbox('Use keybind (Otherwise, uses OSC to check afk status)', default=False, enable_events=True, key='useAfkKeybind')]
], expand_x=True, size=(379, 130))]
]
, scrollable=True, vertical_scroll_only=True, expand_x=True, expand_y=True, background_color=accentColor)]]
preview_layout = [[sg.Column(
[[sg.Text('Preview (Not Perfect)', background_color=accentColor, font=('Arial', 12, 'bold')),sg.Text('', key='sentCountdown')],