Added config option to hide media's total duration

This commit is contained in:
Phin 2022-09-06 01:05:22 +05:30
parent 1792552745
commit b66eae9b6b
5 changed files with 10 additions and 6 deletions

View file

@ -4,7 +4,7 @@
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). 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.3.0 Current Version: 2.3.1
## Getting Started ## Getting Started
@ -26,10 +26,11 @@ The script must be running on the same machine as your Discord client.
* `logging` * `logging`
* `debug` (boolean, default: `true`) - Outputs additional debug-helpful information to the console if enabled. * `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 a `console.log` file if enabled. * `writeToFile` (boolean, default: `false`) - Writes everything outputted to the console to a `console.log` file if enabled.
* `display` * `display` - Display settings for Rich Presence
* `useRemainingTime` (boolean, default: `false`) - Displays your media's remaining time instead of elapsed time in your Rich Presence if enabled. * `hideTotalTime` (boolean, default: `false`) - Hides the total duration of the media if enabled.
* `useRemainingTime` (boolean, default: `false`) - Displays the media's remaining time instead of elapsed time if enabled.
* `posters` * `posters`
* `enabled` (boolean, default: `false`) - Displays media posters in Rich Presence if enabled. Requires `imgurClientID`. * `enabled` (boolean, default: `false`) - Displays media posters if enabled. Requires `imgurClientID`.
* `imgurClientID` (string, default: `""`) - [Obtention Instructions](#obtaining-an-imgur-client-id) * `imgurClientID` (string, default: `""`) - [Obtention Instructions](#obtaining-an-imgur-client-id)
* `buttons` (list) - [Information](#buttons) * `buttons` (list) - [Information](#buttons)
* `label` (string) - The label to be displayed on the button. * `label` (string) - The label to be displayed on the button.
@ -69,6 +70,7 @@ During runtime, the following dynamic URL placeholders will get replaced with re
"writeToFile": false "writeToFile": false
}, },
"display": { "display": {
"hideTotalTime": false,
"useRemainingTime": false, "useRemainingTime": false,
"posters": { "posters": {
"enabled": true, "enabled": true,

View file

@ -13,6 +13,7 @@ class Button(TypedDict):
url: str url: str
class Display(TypedDict): class Display(TypedDict):
hideTotalTime: bool
useRemainingTime: bool useRemainingTime: bool
posters: Posters posters: Posters
buttons: list[Button] buttons: list[Button]

View file

@ -181,7 +181,7 @@ class PlexAlertListener(threading.Thread):
title: str title: str
thumb: str thumb: str
if mediaType in ["movie", "episode"]: if mediaType in ["movie", "episode"]:
stateStrings: list[str] = [formatSeconds(item.duration / 1000)] stateStrings: list[str] = [] if config["display"]["hideTotalTime"] else [formatSeconds(item.duration / 1000)]
if mediaType == "movie": if mediaType == "movie":
title = f"{item.title} ({item.year})" title = f"{item.title} ({item.year})"
genres: list[Genre] = item.genres[:3] genres: list[Genre] = item.genres[:3]

View file

@ -12,6 +12,7 @@ config: models.config.Config = {
"writeToFile": False, "writeToFile": False,
}, },
"display": { "display": {
"hideTotalTime": False,
"useRemainingTime": False, "useRemainingTime": False,
"posters": { "posters": {
"enabled": False, "enabled": False,

View file

@ -2,7 +2,7 @@ import os
import sys import sys
name = "Discord Rich Presence for Plex" name = "Discord Rich Presence for Plex"
version = "2.3.0" version = "2.3.1"
plexClientID = "discord-rich-presence-plex" plexClientID = "discord-rich-presence-plex"
discordClientID = "413407336082833418" discordClientID = "413407336082833418"