discord_presence_plex.py
· 536 B · Python
Raw
from pypresence import Presence # https://github.com/qwertyquerty/pypresence
from requests import get
from time import sleep
client_id = "556909532417228919"
user = "blha303"
tautulli_instance = "https://tau.home.b303.me" # https://github.com/Tautulli/Tautulli
RPC = Presence(client_id)
RPC.connect()
while 1:
my = [s for s in get(tautulli_instance + "/get_activity").json()["sessions"] if s["user"] == user]
if my:
RPC.update(state=" | ".join(_["full_title"] for _ in my))
else:
RPC.clear()
sleep(15)
| 1 | from pypresence import Presence # https://github.com/qwertyquerty/pypresence |
| 2 | from requests import get |
| 3 | from time import sleep |
| 4 | |
| 5 | client_id = "556909532417228919" |
| 6 | user = "blha303" |
| 7 | tautulli_instance = "https://tau.home.b303.me" # https://github.com/Tautulli/Tautulli |
| 8 | |
| 9 | RPC = Presence(client_id) |
| 10 | RPC.connect() |
| 11 | |
| 12 | while 1: |
| 13 | my = [s for s in get(tautulli_instance + "/get_activity").json()["sessions"] if s["user"] == user] |
| 14 | if my: |
| 15 | RPC.update(state=" | ".join(_["full_title"] for _ in my)) |
| 16 | else: |
| 17 | RPC.clear() |
| 18 | sleep(15) |