Added more display config properties

This commit is contained in:
Phin 2024-10-17 23:49:30 +05:30
parent b0bb709423
commit 11ffb01a40
4 changed files with 17 additions and 5 deletions

View file

@ -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.

View file

@ -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",

View file

@ -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

View file

@ -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