From 2a2689bfb796e7c7505d635e8c71767ab2f9dd3c Mon Sep 17 00:00:00 2001 From: Diamond Creeper Date: Mon, 2 Dec 2024 21:43:00 +1300 Subject: [PATCH] Fix the issue --- .gitignore | 1 + JellyfinDiscordRPC/Program.cs | 9 ++++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 7746db7..3f4d5f5 100644 --- a/.gitignore +++ b/.gitignore @@ -54,3 +54,4 @@ ehthumbs.db # ASP.NET Core web app wwwroot/ +*.cache diff --git a/JellyfinDiscordRPC/Program.cs b/JellyfinDiscordRPC/Program.cs index 7625074..b67f67a 100644 --- a/JellyfinDiscordRPC/Program.cs +++ b/JellyfinDiscordRPC/Program.cs @@ -58,7 +58,6 @@ class Program await updateTask; // Wait for the rich presence update task to finish } - private static async Task UpdateRichPresence() { while (true) @@ -98,8 +97,8 @@ class Program Timestamps = new Timestamps { Start = DateTime.UtcNow - playingInfo.Progress, - End = playingInfo.EndDate - }, + End = DateTime.UtcNow + (playingInfo.Duration - playingInfo.Progress) + }, Assets = new Assets { LargeImageKey = largeImageKey, @@ -163,7 +162,7 @@ class Program var configJson = JsonSerializer.Serialize(_config, new JsonSerializerOptions { WriteIndented = true }); File.WriteAllText(ConfigFilePath, configJson); - Console.WriteLine("Configuration saved to config.json."); + Console.WriteLine("Configuration saved to config.json."); } } @@ -214,7 +213,7 @@ class Program Duration = TimeSpan.FromTicks((long)nowPlaying["RunTimeTicks"]), IsMusic = isMusic, NowPlayingItem = nowPlaying, - EndDate = new DateTime((long)nowPlaying["RunTimeTicks"]) + EndDate = DateTime.UtcNow + TimeSpan.FromTicks((long)nowPlaying["RunTimeTicks"]) // Calculating end date based on duration }; } }