Last active 1670065456

uses Tautulli as an easy way to get plex session data. has to be run on the same machine as your discord desktop client for access to RPC

Revision 377a7429494398a56f14e7bdd60b500ab7f67f0f

discord_presence_plex.py Raw
1from pypresence import Presence # https://github.com/qwertyquerty/pypresence
2from requests import get
3from time import sleep
4
5client_id = "556909532417228919"
6user = "blha303"
7tautulli_instance = "https://tau.home.b303.me" # https://github.com/Tautulli/Tautulli
8
9RPC = Presence(client_id)
10RPC.connect()
11
12while 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)