.github | ||
models | ||
services | ||
store | ||
utils | ||
.gitignore | ||
LICENSE | ||
main.py | ||
pyrightconfig.json | ||
README.md | ||
requirements.txt |
Discord Rich Presence for Plex
A Python script that displays your Plex status on Discord using Rich Presence.
Current Version: 2.3.0
Getting Started
- Install Python 3.10 - Make sure to tick "Add Python 3.10 to PATH" during the installation
- Download this repository's contents
- Extract the folder contained in the above ZIP file
- Navigate a command-line interface (cmd.exe, PowerShell, bash, etc.) into the above-extracted directory
- Install the required Python modules by running
python -m pip install -U -r requirements.txt
- Start the script by running
python main.py
When the script runs for the first time, a config.json
file will be created in the working directory and you will be prompted to complete the authentication flow to allow the script to retrieve an access token for your Plex account.
The script must be running on the same machine as your Discord client.
Configuration - config.json
Reference
logging
debug
(boolean, default:true
) - Outputs additional debug-helpful information to the console if enabled.writeToFile
(boolean, default:false
) - Writes everything outputted to the console to aconsole.log
file if enabled.
display
useRemainingTime
(boolean, default:false
) - Displays your media's remaining time instead of elapsed time in your Rich Presence if enabled.posters
enabled
(boolean, default:false
) - Displays media posters in Rich Presence if enabled. RequiresimgurClientID
.imgurClientID
(string, default:""
) - Obtention Instructions
buttons
(list) - Informationlabel
(string) - The label to be displayed on the button.url
(string) - A web address or a dynamic URL placeholder.
users
(list)token
(string) - An access token associated with your Plex account. (X-Plex-Token, Authenticating with Plex)servers
(list)name
(string) - Name of the Plex Media Server you wish to connect to.listenForUser
(string, optional) - The script will respond to alerts originating only from this username. Defaults to the parent user's username if not set.blacklistedLibraries
(list, optional) - Alerts originating from libraries in this list are ignored.whitelistedLibraries
(list, optional) - If set, alerts originating from libraries that are not in this list are ignored.
Obtaining an Imgur client ID
- Go to Imgur's application registration page
- Enter any name for the application and pick OAuth2 without a callback URL as the authorisation type
- Submit the form to obtain your application's client ID
Buttons
A maximum of 2 buttons can be displayed in your Rich Presence.
Due to a strange Discord bug, buttons displayed in your Rich Presence are unresponsive to your own clicks, but other users are able to click on them to open their corresponding URLs.
Dynamic Button URLs
During runtime, the following dynamic URL placeholders will get replaced with real URLs based on the media being played:
dynamic:imdb
dynamic:tmdb
Example
{
"logging": {
"debug": true,
"writeToFile": false
},
"display": {
"useRemainingTime": false,
"posters": {
"enabled": true,
"imgurClientID": "9e9sf637S8bRp4z"
},
"buttons": [
{
"label": "IMDb Link",
"url": "dynamic:imdb"
},
{
"label": "My YouTube Channel",
"url": "https://www.youtube.com/"
}
]
},
"users": [
{
"token": "HPbrz2NhfLRjU888Rrdt",
"servers": [
{
"name": "Bob's Home Media Server"
},
{
"name": "A Friend's Server",
"listenForUser": "xyz",
"whitelistedLibraries": ["Movies"]
}
]
}
]
}
License
This project is licensed under the MIT License. See the LICENSE file for details.