From 11ffb01a401e524b894eeda6bfa03aef9d3c18ad Mon Sep 17 00:00:00 2001 From: Phin <59180111+phin05@users.noreply.github.com> Date: Thu, 17 Oct 2024 23:49:30 +0530 Subject: [PATCH] Added more display config properties --- README.md | 5 ++++- core/config.py | 3 +++ core/plex.py | 11 +++++++---- models/config.py | 3 +++ 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 8af83c6..6d89b72 100644 --- a/README.md +++ b/README.md @@ -36,9 +36,12 @@ The config file is stored in a directory named `data`. - `debug` (boolean, default: `true`) - Outputs additional debug-helpful information to the console. - `writeToFile` (boolean, default: `false`) - Writes console output to a `console.log` file in the `data` directory. - `display` - Display settings for Rich Presence - - `duration` (boolean, default: `true`) - Displays the total duration. + - `duration` (boolean, default: `true`) - Displays the total duration. Applicable to movies and TV shows only. - `genres` (boolean, default: `true`) - Displays the genre. Applicable to movies only. - `album` (boolean, default: `true`) - Displays the album name. Applicable to music only. + - `albumImage` (boolean, default: `true`) - Displays the album image. Applicable to music only. + - `artist` (boolean, default: `true`) - Displays the artist name. Applicable to music only. + - `artistImage` (boolean, default: `true`) - Displays the artist image. Applicable to music only. - `year` (boolean, default: `true`) - Displays the release year. - `statusIcon` (boolean, default: `false`) - Displays a status icon (playing, paused, buffering) at the bottom-right corner of the poster. Applicable to movies and TV shows only. Posters get cropped to a square if this is enabled (Discord bug/limitation). - `progressMode` (string, default: `bar`) - Progress/timestamp display mode. Valid modes are `off`, `elapsed` (displays elapsed time), `remaining` (displays remaining time) and `bar` (displays a progress bar). The `off` and `remaining` modes are currently broken due to a Discord bug/limitation. diff --git a/core/config.py b/core/config.py index 9fa0daf..9f806bf 100644 --- a/core/config.py +++ b/core/config.py @@ -16,6 +16,9 @@ config: models.config.Config = { "duration": True, "genres": True, "album": True, + "albumImage": True, + "artist": True, + "artistImage": True, "year": True, "statusIcon": False, "progressMode": "bar", diff --git a/core/plex.py b/core/plex.py index e944bf2..f17a6da 100644 --- a/core/plex.py +++ b/core/plex.py @@ -271,10 +271,13 @@ class PlexAlertListener(threading.Thread): parent = self.server.fetchItem(item.parentRatingKey) if parent.year: largeText = f"{truncate(largeText, 110)} ({parent.year})" - thumb = item.thumb - smallText = item.originalTitle or item.grandparentTitle - stateStrings.append(smallText) - smallThumb = item.grandparentThumb + if config["display"]["albumImage"]: + thumb = item.thumb + if config["display"]["artist"]: + stateStrings.append(item.originalTitle or item.grandparentTitle) + if config["display"]["artistImage"]: + smallText = item.grandparentTitle or item.originalTitle + smallThumb = item.grandparentThumb else: title = shortTitle = item.title thumb = item.thumb diff --git a/models/config.py b/models/config.py index 2f3c947..1f30c40 100644 --- a/models/config.py +++ b/models/config.py @@ -18,6 +18,9 @@ class Display(TypedDict): duration: bool genres: bool album: bool + albumImage: bool + artist: bool + artistImage: bool year: bool statusIcon: bool progressMode: str