Use Discord RPC to display local Plex session data.
I made this for me; it is really only handling my single use case (Linux environment and a Plex server on local network).
By all means, if someone wants to make this more generic I think they easily could. But, that's not in the scope for this little side project.
The only goal is to watch a show on Plex and have it update my Discord activity.
I just wanted to do something pretty straightforward, so here it is.
- Hit Plex Web API for list of active sessions on server
- Grab local IP and compare to session IP
- Gather session data for current media
- Update Discord activity/status via Discord RPC with media data
- Provide link to Anilist entry if session is watching entry from library 'Anime'
npm install
- rename
config/secrets_template.js
toconfig/secrets.js
and configure (How do I get my Plex token?) npm run start
- install dependencies
sudo npm i pm2@latest -g
- setup app
pm2 start src/plex_discord_rpc.js
- save app process
pm2 save
- enable pm2 to start on boot
pm2 startup
- view status
pm2 list
- There are way better methods to do this, but I'm feeling particularly lazy today; I barely get on Windows anymore.
- Edit setup/Plex_Discord_RPC.bat to match current path of repository
- Create shortcut pointing to setup/Plex_Discord_RPC.bat
- Copy shortcut to
%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup
- If the script fails its not going to start back up. That's another problem for another day.