From 1391220805ae287f110f90a946078eff77f21ab5 Mon Sep 17 00:00:00 2001 From: Phin <59180111+phin05@users.noreply.github.com> Date: Wed, 11 May 2022 06:33:23 +0530 Subject: [PATCH] Tweaks --- README.md | 12 ++++++------ main.py | 8 ++++---- store/constants.py | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index e4535d4..97d179a 100644 --- a/README.md +++ b/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. diff --git a/main.py b/main.py index 02869d7..362555b 100644 --- a/main.py +++ b/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] = [] diff --git a/store/constants.py b/store/constants.py index 302653e..7095725 100644 --- a/store/constants.py +++ b/store/constants.py @@ -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()