mirror of
https://github.com/phin05/discord-rich-presence-plex
synced 2024-11-21 17:13:04 +00:00
Tweaks
This commit is contained in:
parent
e87e567de5
commit
1391220805
3 changed files with 11 additions and 11 deletions
12
README.md
12
README.md
|
@ -2,14 +2,14 @@
|
|||
|
||||
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).
|
||||
|
||||
Current Version: 2.0.2
|
||||
Current Version: 2.0.3
|
||||
|
||||
## Getting Started
|
||||
|
||||
1. Install [Python 3.10](https://www.python.org/downloads/)
|
||||
2. [Download](https://github.com/phin05/discord-rich-presence-plex/archive/refs/heads/master.zip) the ZIP file containing a folder with this repository's code
|
||||
2. Download [this repository's contents](https://github.com/phin05/discord-rich-presence-plex/archive/refs/heads/master.zip)
|
||||
3. Extract the folder contained in the above ZIP file
|
||||
4. Navigate a command-line interface (cmd.exe, PowerShell, bash, etc.) to the directory extracted above
|
||||
4. Navigate a command-line interface (cmd.exe, PowerShell, bash, etc.) into the above extracted directory
|
||||
5. Install the required Python modules by running `python -m pip install -r requirements.txt`
|
||||
6. Start the script by running `python main.py`
|
||||
|
||||
|
@ -22,11 +22,11 @@ The script must be running on the same machine as your Discord client.
|
|||
### Reference
|
||||
|
||||
* `logging`
|
||||
* `debug` - Output more information to the console
|
||||
* `debug` (default: `true`) - Outputs additional debug-helpful information to the console if enabled.
|
||||
* `display`
|
||||
* `useRemainingTime` - Display remaining time in your Rich Presence instead of elapsed time
|
||||
* `useRemainingTime` (default: `false`) - Displays your media's remaining time instead of elapsed time in your Rich Presence if enabled.
|
||||
* `users` (list)
|
||||
* `token` - A [X-Plex-Token](https://support.plex.tv/articles/204059436-finding-an-authentication-token-x-plex-token)
|
||||
* `token` - An authentication 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))
|
||||
* `servers` (list)
|
||||
* `name` - Name of the Plex Media Server you wish to connect to.
|
||||
* `blacklistedLibraries` (optional list) - Alerts originating from libraries in this list are ignored.
|
||||
|
|
8
main.py
8
main.py
|
@ -16,7 +16,7 @@ if config["logging"]["debug"]:
|
|||
PlexAlertListener.useRemainingTime = config["display"]["useRemainingTime"]
|
||||
|
||||
if len(config["users"]) == 0:
|
||||
logger.info("No users found in the config file. Initiating authorisation flow.")
|
||||
logger.info("No users found in the config file. Initiating authentication flow.")
|
||||
response = requests.post("https://plex.tv/api/v2/pins.json?strong=true", headers = {
|
||||
"X-Plex-Product": name,
|
||||
"X-Plex-Client-Identifier": plexClientID,
|
||||
|
@ -25,18 +25,18 @@ if len(config["users"]) == 0:
|
|||
logger.info("https://app.plex.tv/auth#?clientID=%s&code=%s&context%%5Bdevice%%5D%%5Bproduct%%5D=%s", plexClientID, response["code"], urllib.parse.quote(name))
|
||||
for _ in range(10):
|
||||
time.sleep(5)
|
||||
logger.info("Checking whether authorisation was successful...")
|
||||
logger.info("Checking whether authentication was successful...")
|
||||
authCheckResponse = requests.get(f"https://plex.tv/api/v2/pins/{response['id']}.json?code={response['code']}", headers = {
|
||||
"X-Plex-Client-Identifier": plexClientID,
|
||||
}).json()
|
||||
if authCheckResponse["authToken"]:
|
||||
logger.info("Authorisation successful.")
|
||||
logger.info("Authentication successful.")
|
||||
serverName = input("Enter the name of the Plex Media Server you wish to connect to: ")
|
||||
config["users"].append({ "token": authCheckResponse["authToken"], "servers": [{ "name": serverName }] })
|
||||
configService.saveConfig()
|
||||
break
|
||||
else:
|
||||
logger.info("Authorisation failed.")
|
||||
logger.info("Authentication failed.")
|
||||
exit()
|
||||
|
||||
plexAlertListeners: list[PlexAlertListener] = []
|
||||
|
|
|
@ -2,7 +2,7 @@ import sys
|
|||
import os
|
||||
|
||||
name = "Discord Rich Presence for Plex"
|
||||
version = "2.0.2"
|
||||
version = "2.0.3"
|
||||
plexClientID = "discord-rich-presence-plex"
|
||||
isUnix = sys.platform in ["linux", "darwin"]
|
||||
processID = os.getpid()
|
||||
|
|
Loading…
Reference in a new issue