From a783b3c7397335e6e71d12e308297eb6b8b5a679 Mon Sep 17 00:00:00 2001 From: hsvflight <39955795+hsvflight@users.noreply.github.com> Date: Sun, 15 Jun 2025 21:33:33 -0500 Subject: [PATCH 1/3] Update Plugin.cs - Guid empty Getting this error: [2025-06-16 00:41:58.499 +00:00] [FTL] Unhandled Exception System.ArgumentException: Guid can't be empty (Parameter 'id') at Jellyfin.Plugin.TubeArchivistMetadata.Plugin.OnPlaybackProgress(...) And right after playback fails [2025-06-16 00:42:23.345 +00:00] [INF] Playback stopped reported by app "Jellyfin Roku" "3.0.5" playing "Video". Stopped at "973000" ms --- Jellyfin.Plugin.TubeArchivistMetadata/Plugin.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Jellyfin.Plugin.TubeArchivistMetadata/Plugin.cs b/Jellyfin.Plugin.TubeArchivistMetadata/Plugin.cs index 600fabb..a1662a7 100644 --- a/Jellyfin.Plugin.TubeArchivistMetadata/Plugin.cs +++ b/Jellyfin.Plugin.TubeArchivistMetadata/Plugin.cs @@ -173,6 +173,11 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata private async void OnPlaybackProgress(object? sender, PlaybackProgressEventArgs eventArgs) { + if (eventArgs == null || eventArgs.ItemId == Guid.Empty) + { + Logger.LogWarning("PlaybackProgress called with null or empty Guid."); + return; + } if (Instance!.Configuration.JFTASync && eventArgs.Users.Any(u => Instance!.Configuration.JFUsernameFrom.Equals(u.Username, StringComparison.Ordinal))) { BaseItem? season = LibraryManager.GetItemById(eventArgs.Item.ParentId); From ab783238c3fcf50acfc26e365c94d83d232be9c6 Mon Sep 17 00:00:00 2001 From: Che Cameron Date: Tue, 1 Jul 2025 20:06:27 +0100 Subject: [PATCH 2/3] Reconfigure logging to debug --- .../Configuration/PluginConfiguration.cs | 4 ++-- .../Providers/EpisodeImageProvider.cs | 4 ++-- .../Providers/EpisodeMetadataProvider.cs | 4 ++-- .../Providers/SeriesImageProvider.cs | 8 ++++---- .../Providers/SeriesMetadataProvider.cs | 4 ++-- .../Tasks/JFToTubeArchivistProgressSyncTask.cs | 8 ++++---- .../Tasks/TAToJellyfinProgressSyncTask.cs | 10 +++++----- .../TubeArchivist/TubeArchivistApi.cs | 16 ++++++++-------- 8 files changed, 29 insertions(+), 29 deletions(-) diff --git a/Jellyfin.Plugin.TubeArchivistMetadata/Configuration/PluginConfiguration.cs b/Jellyfin.Plugin.TubeArchivistMetadata/Configuration/PluginConfiguration.cs index e946fba..ce10eef 100644 --- a/Jellyfin.Plugin.TubeArchivistMetadata/Configuration/PluginConfiguration.cs +++ b/Jellyfin.Plugin.TubeArchivistMetadata/Configuration/PluginConfiguration.cs @@ -119,7 +119,7 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.Configuration { get { - _logger.LogDebug("JFUsernamesTo configured: {Message}", string.Join(", ", _jfUsernamesTo)); + _logger.LogInformation("JFUsernamesTo configured: {Message}", string.Join(", ", _jfUsernamesTo)); return string.Join(", ", _jfUsernamesTo); } @@ -138,7 +138,7 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.Configuration } } - _logger.LogDebug("Set JFUsernamesTo to: {Message}", string.Join(", ", _jfUsernamesTo)); + _logger.LogInformation("Set JFUsernamesTo to: {Message}", string.Join(", ", _jfUsernamesTo)); } } diff --git a/Jellyfin.Plugin.TubeArchivistMetadata/Providers/EpisodeImageProvider.cs b/Jellyfin.Plugin.TubeArchivistMetadata/Providers/EpisodeImageProvider.cs index 9454d4a..fa00c01 100644 --- a/Jellyfin.Plugin.TubeArchivistMetadata/Providers/EpisodeImageProvider.cs +++ b/Jellyfin.Plugin.TubeArchivistMetadata/Providers/EpisodeImageProvider.cs @@ -62,8 +62,8 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.Providers var taApi = TubeArchivistApi.GetInstance(); var videoTAId = Utils.GetVideoNameFromPath(item.Path); var video = await taApi.GetVideo(videoTAId).ConfigureAwait(true); - _logger.LogInformation("{Message}", string.Format(CultureInfo.CurrentCulture, "Getting images for video: {0} ({1})", video?.Title, videoTAId)); - _logger.LogInformation("{Message}", "Thumb URI: " + video?.VidThumbUrl); + _logger.LogDebug("{Message}", string.Format(CultureInfo.CurrentCulture, "Getting images for video: {0} ({1})", video?.Title, videoTAId)); + _logger.LogDebug("{Message}", "Thumb URI: " + video?.VidThumbUrl); if (video != null) { diff --git a/Jellyfin.Plugin.TubeArchivistMetadata/Providers/EpisodeMetadataProvider.cs b/Jellyfin.Plugin.TubeArchivistMetadata/Providers/EpisodeMetadataProvider.cs index a5f1f38..d19acb1 100644 --- a/Jellyfin.Plugin.TubeArchivistMetadata/Providers/EpisodeMetadataProvider.cs +++ b/Jellyfin.Plugin.TubeArchivistMetadata/Providers/EpisodeMetadataProvider.cs @@ -53,8 +53,8 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.Providers var taApi = TubeArchivistApi.GetInstance(); var videoTAId = Utils.GetVideoNameFromPath(info.Path); var video = await taApi.GetVideo(videoTAId).ConfigureAwait(true); - _logger.LogInformation("{Message}", string.Format(CultureInfo.CurrentCulture, "Getting metadata for video: {0} ({1})", video?.Title, videoTAId)); - _logger.LogInformation("{Message}", "Received metadata: \n" + JsonConvert.SerializeObject(video)); + _logger.LogDebug("{Message}", string.Format(CultureInfo.CurrentCulture, "Getting metadata for video: {0} ({1})", video?.Title, videoTAId)); + _logger.LogDebug("{Message}", "Received metadata: \n" + JsonConvert.SerializeObject(video)); if (video != null) { diff --git a/Jellyfin.Plugin.TubeArchivistMetadata/Providers/SeriesImageProvider.cs b/Jellyfin.Plugin.TubeArchivistMetadata/Providers/SeriesImageProvider.cs index e67e8a7..6fef96a 100644 --- a/Jellyfin.Plugin.TubeArchivistMetadata/Providers/SeriesImageProvider.cs +++ b/Jellyfin.Plugin.TubeArchivistMetadata/Providers/SeriesImageProvider.cs @@ -60,10 +60,10 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.Providers var taApi = TubeArchivistApi.GetInstance(); var channelTAId = Utils.GetChannelNameFromPath(item.Path); var channel = await taApi.GetChannel(channelTAId).ConfigureAwait(true); - _logger.LogInformation("{Message}", string.Format(CultureInfo.CurrentCulture, "Getting images for channel: {0} ({1})", channel?.Name, channelTAId)); - _logger.LogInformation("{Message}", "Thumb URI: " + channel?.ThumbUrl); - _logger.LogInformation("{Message}", "TVArt URI: " + channel?.TvartUrl); - _logger.LogInformation("{Message}", "Banner URI: " + channel?.BannerUrl); + _logger.LogDebug("{Message}", string.Format(CultureInfo.CurrentCulture, "Getting images for channel: {0} ({1})", channel?.Name, channelTAId)); + _logger.LogDebug("{Message}", "Thumb URI: " + channel?.ThumbUrl); + _logger.LogDebug("{Message}", "TVArt URI: " + channel?.TvartUrl); + _logger.LogDebug("{Message}", "Banner URI: " + channel?.BannerUrl); if (channel != null) { diff --git a/Jellyfin.Plugin.TubeArchivistMetadata/Providers/SeriesMetadataProvider.cs b/Jellyfin.Plugin.TubeArchivistMetadata/Providers/SeriesMetadataProvider.cs index 269ce4f..d44a847 100644 --- a/Jellyfin.Plugin.TubeArchivistMetadata/Providers/SeriesMetadataProvider.cs +++ b/Jellyfin.Plugin.TubeArchivistMetadata/Providers/SeriesMetadataProvider.cs @@ -52,8 +52,8 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.Providers var taApi = TubeArchivistApi.GetInstance(); var channelTAId = Utils.GetChannelNameFromPath(info.Path); var channel = await taApi.GetChannel(channelTAId).ConfigureAwait(true); - _logger.LogInformation("{Message}", string.Format(CultureInfo.CurrentCulture, "Getting metadata for channel: {0} ({1})", channel?.Name, channelTAId)); - _logger.LogInformation("{Message}", "Received metadata: \n" + JsonConvert.SerializeObject(channel)); + _logger.LogDebug("{Message}", string.Format(CultureInfo.CurrentCulture, "Getting metadata for channel: {0} ({1})", channel?.Name, channelTAId)); + _logger.LogDebug("{Message}", "Received metadata: \n" + JsonConvert.SerializeObject(channel)); if (channel != null) { diff --git a/Jellyfin.Plugin.TubeArchivistMetadata/Tasks/JFToTubeArchivistProgressSyncTask.cs b/Jellyfin.Plugin.TubeArchivistMetadata/Tasks/JFToTubeArchivistProgressSyncTask.cs index cc04711..83875db 100644 --- a/Jellyfin.Plugin.TubeArchivistMetadata/Tasks/JFToTubeArchivistProgressSyncTask.cs +++ b/Jellyfin.Plugin.TubeArchivistMetadata/Tasks/JFToTubeArchivistProgressSyncTask.cs @@ -90,7 +90,7 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.Tasks { IncludeItemTypes = new[] { BaseItemKind.Series } }); - _logger.LogInformation("Analyzing collection {Id} with name {Name}", collectionItem.Id, collectionItem.Name); + _logger.LogDebug("Analyzing collection {Id} with name {Name}", collectionItem.Id, collectionItem.Name); _logger.LogDebug("Found {Message} channels", channels.Count); foreach (Series channel in channels) @@ -114,7 +114,7 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.Tasks } } - _logger.LogInformation("Found a total of {VideosCount} videos", videosCount); + _logger.LogDebug("Found a total of {VideosCount} videos", videosCount); var processedVideosCount = 0; if (collectionItem == null) @@ -151,7 +151,7 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.Tasks foreach (Episode video in videos) { var videoYTId = Utils.GetVideoNameFromPath(video.Path); - _logger.LogInformation("{VideoYtId}", videoYTId); + _logger.LogDebug("{VideoYtId}", videoYTId); HttpStatusCode statusCode; if (!isChannelCheckedForWatched && channel.IsPlayed(user)) @@ -179,7 +179,7 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.Tasks _logger.LogCritical("{Message}", $"POST /watched returned {statusCode} for video {video.Name} ({videoYTId}) with wacthed status {isVideoPlayed}"); } - _logger.LogInformation("{Message}", isVideoPlayed); + _logger.LogDebug("{Message}", isVideoPlayed); if (!isVideoPlayed) { var playbackProgress = _userDataManager.GetUserData(user, video).PlaybackPositionTicks / TimeSpan.TicksPerSecond; diff --git a/Jellyfin.Plugin.TubeArchivistMetadata/Tasks/TAToJellyfinProgressSyncTask.cs b/Jellyfin.Plugin.TubeArchivistMetadata/Tasks/TAToJellyfinProgressSyncTask.cs index d42678b..abcf3a7 100644 --- a/Jellyfin.Plugin.TubeArchivistMetadata/Tasks/TAToJellyfinProgressSyncTask.cs +++ b/Jellyfin.Plugin.TubeArchivistMetadata/Tasks/TAToJellyfinProgressSyncTask.cs @@ -90,7 +90,7 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.Tasks { IncludeItemTypes = new[] { BaseItemKind.Series } }); - _logger.LogInformation("Analyzing collection {Id} with name {Name}", collectionItem.Id, collectionItem.Name); + _logger.LogDebug("Analyzing collection {Id} with name {Name}", collectionItem.Id, collectionItem.Name); _logger.LogDebug("Found {Message} channels", channels.Count); foreach (Series channel in channels) @@ -115,7 +115,7 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.Tasks } } - _logger.LogInformation("Found a total of {VideosCount} videos", videosCount); + _logger.LogDebug("Found a total of {VideosCount} videos", videosCount); var processedVideosCount = 0; foreach (var jfUsername in Plugin.Instance!.Configuration.GetJFUsernamesToArray()) @@ -123,7 +123,7 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.Tasks var user = _userManager.GetUserByName(jfUsername); if (user == null) { - _logger.LogInformation("{Message}", $"Jellyfin user with username {jfUsername} not found"); + _logger.LogDebug("{Message}", $"Jellyfin user with username {jfUsername} not found"); continue; } @@ -185,8 +185,8 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.Tasks } _userDataManager.SaveUserData(user, video, userUpdateData, UserDataSaveReason.UpdateUserData); - _logger.LogInformation("{Message}", $"Playback progress for video {video.Name} set to {userItemData.PlaybackPositionTicks / TimeSpan.TicksPerSecond} seconds for user {jfUsername}."); - _logger.LogInformation("{Message}", $"Watched status for video {video.Name} set to {userItemData.Played} seconds for user {jfUsername}."); + _logger.LogDebug("{Message}", $"Playback progress for video {video.Name} set to {userItemData.PlaybackPositionTicks / TimeSpan.TicksPerSecond} seconds for user {jfUsername}."); + _logger.LogDebug("{Message}", $"Watched status for video {video.Name} set to {userItemData.Played} seconds for user {jfUsername}."); processedVideosCount++; progress.Report(processedVideosCount * 100 / videosCount); diff --git a/Jellyfin.Plugin.TubeArchivistMetadata/TubeArchivist/TubeArchivistApi.cs b/Jellyfin.Plugin.TubeArchivistMetadata/TubeArchivist/TubeArchivistApi.cs index 18e4672..fc10f6b 100644 --- a/Jellyfin.Plugin.TubeArchivistMetadata/TubeArchivist/TubeArchivistApi.cs +++ b/Jellyfin.Plugin.TubeArchivistMetadata/TubeArchivist/TubeArchivistApi.cs @@ -73,11 +73,11 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.TubeArchivist while (response.StatusCode == HttpStatusCode.Moved) { url = response.Headers.Location; - _logger.LogInformation("{Message}", "Received redirect to: " + url); + _logger.LogDebug("{Message}", "Received redirect to: " + url); response = await client.GetAsync(url).ConfigureAwait(true); } - _logger.LogInformation("{Message}", url + ": " + response.StatusCode); + _logger.LogDebug("{Message}", url + ": " + response.StatusCode); if (response.IsSuccessStatusCode) { @@ -103,16 +103,16 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.TubeArchivist while (response.StatusCode == HttpStatusCode.Moved) { url = response.Headers.Location; - _logger.LogInformation("{Message}", "Received redirect to: " + url); + _logger.LogDebug("{Message}", "Received redirect to: " + url); response = await client.GetAsync(url).ConfigureAwait(true); } - _logger.LogInformation("{Message}", url + ": " + response.StatusCode); + _logger.LogDebug("{Message}", url + ": " + response.StatusCode); if (response.IsSuccessStatusCode) { string rawData = await response.Content.ReadAsStringAsync().ConfigureAwait(true); - _logger.LogInformation("{Message}", rawData); + _logger.LogDebug("{Message}", rawData); video = JsonConvert.DeserializeObject