slight refactor
This commit is contained in:
parent
8333218d99
commit
2a6c0a6039
@ -51,9 +51,9 @@ class DBus:
|
|||||||
'name': str(" ".join(self.interface_details.get('xesam:artist'))),
|
'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'))}',
|
'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])
|
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
|
return self.plex_np
|
||||||
except:
|
except:
|
||||||
self.plex_np = {
|
self.plex_np = {
|
||||||
@ -104,22 +104,13 @@ class DiscordPresence:
|
|||||||
now = time.time()
|
now = time.time()
|
||||||
plex = self.dbus.is_plexing()
|
plex = self.dbus.is_plexing()
|
||||||
if plex:
|
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_current = self.dbus.plex_np
|
||||||
plex_new = self.dbus.get_now_playing()
|
plex_new = self.dbus.get_now_playing()
|
||||||
|
|
||||||
print(f"new: {plex_new}")
|
|
||||||
if plex_current == plex_new:
|
if plex_current == plex_new:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
||||||
if self.last_updated and (now - self.last_updated < 5):
|
if self.last_updated and (now - self.last_updated < 5):
|
||||||
# print(f"Skip: {self.last_track} & {(now - self.last_updated)}")
|
|
||||||
time.sleep(0.7)
|
time.sleep(0.7)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@ -165,7 +156,6 @@ class DiscordPresence:
|
|||||||
end_time = data.get('end')
|
end_time = data.get('end')
|
||||||
track = f"{data.get('artist')} - {data.get('title')}"
|
track = f"{data.get('artist')} - {data.get('title')}"
|
||||||
if self.last_updated and (now - self.last_updated < 5):
|
if self.last_updated and (now - self.last_updated < 5):
|
||||||
# print(f"Skip: {self.last_track} & {(now - self.last_updated)}")
|
|
||||||
time.sleep(0.7)
|
time.sleep(0.7)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user