44import threading
55import functools
66
7+
78class RichPresenceManager :
89 def __init__ (self ):
910 self .client_id = "1340358329771364430"
@@ -12,8 +13,6 @@ def __init__(self):
1213 self .current_state = "Idling"
1314 self .lock = threading .Lock ()
1415 self .discord_available = True
15-
16-
1716
1817 def start_presence (self ):
1918 try :
@@ -48,7 +47,12 @@ def update_presence(self):
4847 self .rpc .update (
4948 state = self .current_state ,
5049 details = "Advanced RVC Inference UI" ,
51- buttons = [{"label" : "Download" , "url" : "https://github.com/ArkanDash/Advanced-RVC-Inference.git" }],
50+ buttons = [
51+ {
52+ "label" : "Download" ,
53+ "url" : "https://github.com/ArkanDash/Advanced-RVC-Inference.git" ,
54+ }
55+ ],
5256 large_image = "logo" ,
5357 large_text = "Advanced RVC Inference for quicker and effortless model downloads" ,
5458 small_image = config ["small_image" ],
@@ -80,8 +84,10 @@ def cleanup(self):
8084 def stop_presence (self ):
8185 self .cleanup ()
8286
87+
8388RPCManager = RichPresenceManager ()
8489
90+
8591def track_presence (state_message ):
8692 def decorator (func ):
8793 @functools .wraps (func )
@@ -94,5 +100,7 @@ def wrapper(*args, **kwargs):
94100 finally :
95101 if RPCManager .running and RPCManager .discord_available :
96102 RPCManager .set_state ("Idling" )
103+
97104 return wrapper
105+
98106 return decorator
0 commit comments