No description
Find a file
Daklyan 399eb5fc60
All checks were successful
Docker image push / Test Docker Build (push) Successful in 1m44s
Docker image push / Build and Push Docker Image (push) Successful in 31s
?
2025-09-13 18:51:32 +02:00
.forgejo/workflows ? 2025-09-13 18:51:32 +02:00
img more readme updates 2025-08-26 16:08:38 +02:00
patchedPypresence adding imdb url in rpc 2025-09-13 17:38:07 +02:00
utils adding imdb url in rpc 2025-09-13 17:38:07 +02:00
.gitignore dynamic images 2024-11-04 22:45:40 +01:00
config.example.json working migration to x-plex-token 2025-08-12 22:46:42 +02:00
config.py working migration to x-plex-token 2025-08-12 22:46:42 +02:00
docker-compose.yml some readme update 2025-08-26 15:47:40 +02:00
Dockerfile dockerfile optimization 2025-09-12 17:28:00 +02:00
LICENSE some small changes 2025-08-26 15:07:14 +02:00
main.py adding imdb url in rpc 2025-09-13 17:38:07 +02:00
README.md more readme updates 2025-08-26 16:10:03 +02:00
requirements.txt some refacto and reorg 2025-08-26 00:10:31 +02:00

Plex activity as Discord RPC

Intro

This project makes a RPC in discord of your current activity on Plex

Setup

To get Plex activity will need your X-Plex-Token, look at here if you don't know how

Install required packages

pip install -r requirements.txt

Copy the config example and update the value

cp config.example.json config.json
{
    "username" : "", <- Plex user to track by the script, if you leave it blank it will apply to any user
    "client_id" : "changeme", <- ID of the discord application
    "libraries": [], <- Plex library to track by the script, if you leave it blank it will apply to every library of the plex server
    "fanarttv_apikey": "changeme", <- API Key to get Artist illustration on fanart.tv
    "tvdb_apikey": "changeme", <- API Key to get Show/Movie illustration from tvdb
    "x_plex_token": "changeme", <- X-Plex-Token to get Plex activity
    "plex_address": "127.0.0.1",
    "plex_port": "32400"
}

Discord application setup

App creation

For discord to display your RPC you need to create an application on the dev portal (https://discord.com/developers/applications/)

The process is very straight forward

Just click on "New Application"

New Application

Add an app name, accept the ToS and click create

Creation

After that you'll be on your newly created app page

Setting up the discord app

On your app page you'll find your discord app ID that you need to put in your config file for the script to work

App id

That's all you need for your app to be functionnal

But to make our RPC a bit prettier we're gonna add a few images on our app

App assets

You can use your own images or the ones in img/plex on this repo

The important part is the naming as the code lookup by name the images

Here are the categories :

  • plex (default picture)
  • movie
  • show
  • music
  • play
  • pause

Here's how the assets page looks with the repo images

Assets page filled

And how the RPC looks

RPC example

And the fallback version if it can't get media cover

RPC fallback example

Launching the script manually

Just launch the main.py

python3 main.py

You may experience errors if you have medias with UTF-8 characters in the name for the logging

To avoid that you can run

python3 -X utf8 main.py

Using docker

Building and running the Docker Image

⚠️ Only works for linux atm as I mount the socket in the docker compose

⚠️ The path for the Discord socket might vary from a distro to another

With docker compose

docker compose up -d --build

Pure docker

docker build -t plex-discord-rpc .
docker run -d --name plex-discord-rpc --network host \
  --restart unless-stopped \
  -e TZ=Europe/Paris \
  -v /run/user/1000/discord-ipc-0:/tmp/discord-ipc-0:ro \
  -v ./plex_rpc.log:/app/plex_rpc.log \
  -v ./config.json:/app/config.json \
  plex-discord-rpc