slight refactor

This commit is contained in:
codey 2024-12-26 18:06:00 -05:00
parent 8333218d99
commit 2a6c0a6039

View File

@ -51,9 +51,9 @@ class DBus:
'name': str(" ".join(self.interface_details.get('xesam:artist'))),
'details': f'{str(self.interface_details.get('xesam:album', ''))} {str(self.interface_details.get('xesam:title'))}',
}
if not self.plex_last or (self.plex_np.get('name') == self.plex_last.get('name') and self.plex_np.get('details') == self.plex_last.get('details')):
if not self.plex_last or\
(self.plex_np.get('name') == self.plex_last.get('name') and self.plex_np.get('details') == self.plex_last.get('details')):
self.plex_np['art'] = self.catbox.upload(original_art.split("file://", maxsplit=1)[1])
print(f"Path: {original_art.split("file://", maxsplit=0)[0]}")
return self.plex_np
except:
self.plex_np = {
@ -104,22 +104,13 @@ class DiscordPresence:
now = time.time()
plex = self.dbus.is_plexing()
if plex:
RPC.client_id = self.client_id_plex
# if RPC.client_id != self.client_id_plex:
# RPC = Presence(self.client_id_plex, pipe=0)
# print(f"Connecting")
# RPC.connect()
# print(f"Connected")
plex_current = self.dbus.plex_np
plex_new = self.dbus.get_now_playing()
print(f"new: {plex_new}")
if plex_current == plex_new:
continue
if self.last_updated and (now - self.last_updated < 5):
# print(f"Skip: {self.last_track} & {(now - self.last_updated)}")
time.sleep(0.7)
continue
@ -165,7 +156,6 @@ class DiscordPresence:
end_time = data.get('end')
track = f"{data.get('artist')} - {data.get('title')}"
if self.last_updated and (now - self.last_updated < 5):
# print(f"Skip: {self.last_track} & {(now - self.last_updated)}")
time.sleep(0.7)
continue