Fix displaying movie status

Removed showing "Season N/A, Episode N/A" when watching a movie
This commit is contained in:
Diamond Creeper 2024-11-30 22:51:14 +13:00
parent 52ab4c6398
commit b1cbe1988d
6 changed files with 9 additions and 5 deletions

View file

@ -24,7 +24,7 @@
"RelativeDocumentMoniker": "JellyfinDiscordRPC\\Program.cs",
"ToolTip": "C:\\Users\\joshua\\Documents\\GitHub\\jellyfin-discord-rpc\\JellyfinDiscordRPC\\Program.cs",
"RelativeToolTip": "JellyfinDiscordRPC\\Program.cs",
"ViewState": "AgIAACcAAAAAAAAAAADwv0UAAAAnAAAAAAAAAA==",
"ViewState": "AgIAAEEAAAAAAAAAAAAswGQAAAAFAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-11-30T05:30:39.706Z",
"EditorCaption": ""

View file

@ -24,7 +24,7 @@
"RelativeDocumentMoniker": "JellyfinDiscordRPC\\Program.cs",
"ToolTip": "C:\\Users\\joshua\\Documents\\GitHub\\jellyfin-discord-rpc\\JellyfinDiscordRPC\\Program.cs",
"RelativeToolTip": "JellyfinDiscordRPC\\Program.cs",
"ViewState": "AgIAADkAAAAAAAAAAADwv0IAAAA/AAAAAAAAAA==",
"ViewState": "AgIAADUAAAAAAAAAAAAswGQAAAAFAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-11-30T05:30:39.706Z",
"EditorCaption": ""

View file

@ -56,18 +56,22 @@ class Program
string details = playingInfo.IsMusic
? $"{playingInfo.Title}" // Show song name
: $"Watching: {nowPlaying["SeriesName"]?.ToString() ?? "Unknown Series"} - {playingInfo.Title}"; // Show series and episode name
: nowPlaying["SeriesName"] != null
? $"Watching: {nowPlaying["SeriesName"]} - {playingInfo.Title}" // Show series and episode name
: $"Watching: {playingInfo.Title}"; // For movies, show only the title
string state = playingInfo.IsMusic
? $"{playingInfo.Artist}" // Show artist name
: $"Season {playingInfo.Season}, Episode {playingInfo.Episode}";
: nowPlaying["SeriesName"] != null
? $"Season {playingInfo.Season}, Episode {playingInfo.Episode}" // Show season and episode for series
: ""; // Leave state empty for movies
Console.WriteLine($"Updating presence with details: {details}, state: {state}");
_discordClient.SetPresence(new RichPresence
{
Details = details,
State = state,
State = string.IsNullOrWhiteSpace(state) ? null : state, // Avoid sending empty state to Discord
Timestamps = new Timestamps
{
Start = DateTime.UtcNow - playingInfo.Progress,