2018-02-14 18:50:41 +00:00
# Discord Rich Presence for Plex
2022-05-12 10:52:18 +00:00
![image ](https://user-images.githubusercontent.com/59180111/168054648-af0590fd-9bd7-42d0-91b2-d7974643debd.png )
2022-05-10 20:23:12 +00:00
A Python script that displays your [Plex ](https://www.plex.tv ) status on [Discord ](https://discord.com ) using [Rich Presence ](https://discord.com/developers/docs/rich-presence/how-to ).
2018-02-14 18:50:41 +00:00
2022-06-27 15:32:52 +00:00
Current Version: 2.2.5
2022-05-11 00:37:38 +00:00
2022-05-10 20:23:12 +00:00
## Getting Started
2018-02-14 18:50:41 +00:00
2022-05-11 07:30:23 +00:00
1. Install [Python 3.10 ](https://www.python.org/downloads/ ) - Make sure to tick "Add Python 3.10 to PATH" during the installation
2022-05-11 01:03:23 +00:00
2. Download [this repository's contents ](https://github.com/phin05/discord-rich-presence-plex/archive/refs/heads/master.zip )
2022-05-11 00:42:08 +00:00
3. Extract the folder contained in the above ZIP file
2022-05-11 01:10:28 +00:00
4. Navigate a command-line interface (cmd.exe, PowerShell, bash, etc.) into the above-extracted directory
2022-05-11 01:20:22 +00:00
5. Install the required Python modules by running `python -m pip install -U -r requirements.txt`
2022-05-10 20:23:12 +00:00
6. Start the script by running `python main.py`
2018-02-14 18:50:41 +00:00
2022-05-11 00:03:51 +00:00
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.
2018-02-14 18:50:41 +00:00
2022-05-10 20:23:12 +00:00
The script must be running on the same machine as your Discord client.
2018-04-24 19:12:55 +00:00
2022-05-10 20:23:12 +00:00
## Configuration - `config.json`
2018-04-24 19:12:55 +00:00
2022-05-10 20:23:12 +00:00
### Reference
2018-04-24 19:12:55 +00:00
2022-05-10 20:23:12 +00:00
* `logging`
2022-05-11 02:19:49 +00:00
* `debug` (boolean, default: `true` ) - Outputs additional debug-helpful information to the console if enabled.
2022-05-22 17:03:17 +00:00
* `writeToFile` (boolean, default: `false` ) - Writes everything outputted to the console to a `console.log` file if enabled.
2022-05-10 20:23:12 +00:00
* `display`
2022-05-11 02:19:49 +00:00
* `useRemainingTime` (boolean, default: `false` ) - Displays your media's remaining time instead of elapsed time in your Rich Presence if enabled.
2022-05-12 07:14:23 +00:00
* `posters`
2022-05-12 07:32:53 +00:00
* `enabled` (boolean, default: `false` ) - Displays media posters in Rich Presence if enabled. Requires `imgurClientID` .
* `imgurClientID` (string, default: `""` ) - [Instructions ](#obtaining-an-imgur-client-id )
2022-05-10 20:23:12 +00:00
* `users` (list)
2022-05-11 02:19:49 +00:00
* `token` (string) - An access token associated with your Plex account. ([X-Plex-Token](https://support.plex.tv/articles/204059436-finding-an-authentication-token-x-plex-token), [Authenticating with Plex ](https://forums.plex.tv/t/authenticating-with-plex/609370 ))
2022-05-10 20:23:12 +00:00
* `servers` (list)
2022-05-11 02:19:49 +00:00
* `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.
2018-04-24 19:12:55 +00:00
2022-05-12 07:14:23 +00:00
### Obtaining an Imgur client ID
1. Go to Imgur's [application registration page ](https://api.imgur.com/oauth2/addclient )
2. Enter any name for the application and pick OAuth2 without a callback URL as the authorisation type
3. Submit the form to obtain your application's client ID
2022-05-10 20:23:12 +00:00
### Example
2018-04-24 19:12:55 +00:00
2022-05-10 20:23:12 +00:00
```json
{
"logging": {
2022-05-22 04:37:09 +00:00
"debug": true,
"writeToFile": false
2022-05-10 20:23:12 +00:00
},
"display": {
2022-05-12 07:14:23 +00:00
"useRemainingTime": false,
"posters": {
"enabled": true,
"imgurClientID": "9e9sf637S8bRp4z"
}
2022-05-10 20:23:12 +00:00
},
"users": [
{
"token": "HPbrz2NhfLRjU888Rrdt",
"servers": [
{
2022-05-11 00:16:02 +00:00
"name": "Bob's Home Media Server"
2022-05-10 20:23:12 +00:00
},
{
"name": "A Friend's Server",
2022-05-11 01:50:06 +00:00
"listenForUser": "xyz",
2022-05-10 20:23:12 +00:00
"whitelistedLibraries": ["Movies"]
}
]
}
]
}
```
2018-02-14 20:21:51 +00:00
## License
2022-05-10 20:23:12 +00:00
This project is licensed under the MIT License. See the [LICENSE ](LICENSE ) file for details.
## Credits
* [Discord ](https://discord.com )
* [Plex ](https://www.plex.tv )
2022-05-11 01:20:22 +00:00
* [Python-PlexAPI ](https://github.com/pkkid/python-plexapi )
2022-05-11 07:30:23 +00:00
* [Requests ](https://github.com/psf/requests )
2022-05-10 20:23:12 +00:00
* [websocket-client ](https://github.com/websocket-client/websocket-client )