Merge branch 'master' into jellyfin-10.11

This commit is contained in:
DarkFighterLuke
2025-10-20 22:14:56 +02:00
committed by GitHub
9 changed files with 39 additions and 47 deletions
@@ -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));
}
}
+12 -20
View File
@@ -38,7 +38,6 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata
/// <param name="logger">Instance of the <see cref="ILogger"/> interface.</param>
/// <param name="sessionManager">Instance of the <see cref="ISessionManager"/> interface.</param>
/// <param name="libraryManager">Instance of the <see cref="ILibraryManager"/> interface.</param>
/// <param name="taskManager">Instance of the <see cref="ITaskManager"/> interface.</param>
/// <param name="userManager">Instance of the <see cref="IUserManager"/> interface.</param>
/// <param name="userDataManager">Instance of the <see cref="IUserDataManager"/> interface.</param>
public Plugin(
@@ -47,7 +46,6 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata
ILogger<Plugin> logger,
ISessionManager sessionManager,
ILibraryManager libraryManager,
ITaskManager taskManager,
IUserManager userManager,
IUserDataManager userDataManager)
: base(applicationPaths, xmlSerializer)
@@ -67,24 +65,6 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata
_userDataManager = userDataManager;
userDataManager.UserDataSaved += OnWatchedStatusChange;
var taToJellyfinProgressSyncTask = new TAToJellyfinProgressSyncTask(logger, libraryManager, userManager, userDataManager);
var jfToTubearchivistProgressSyncTask = new JFToTubearchivistProgressSyncTask(logger, libraryManager, userManager, userDataManager);
var isTAJFTaskPresent = taskManager.ScheduledTasks.Any(t => t.Name.Equals(taToJellyfinProgressSyncTask.Name, StringComparison.Ordinal));
if (Instance!.Configuration.TAJFSync && !isTAJFTaskPresent)
{
logger.LogInformation("Queueing task {TaskName}.", taToJellyfinProgressSyncTask.Name);
taskManager.AddTasks([taToJellyfinProgressSyncTask]);
taskManager.Execute<TAToJellyfinProgressSyncTask>();
}
var isJFTATaskPresent = taskManager.ScheduledTasks.Any(t => t.Name.Equals(jfToTubearchivistProgressSyncTask.Name, StringComparison.Ordinal));
if (Instance!.Configuration.JFTASync && !isJFTATaskPresent)
{
logger.LogInformation("Queueing task {TaskName}.", jfToTubearchivistProgressSyncTask.Name);
taskManager.AddTasks([jfToTubearchivistProgressSyncTask]);
taskManager.Execute<JFToTubearchivistProgressSyncTask>();
}
logger.LogInformation("{Message}", "Collection display name: " + Instance?.Configuration.CollectionTitle);
logger.LogInformation("{Message}", "TubeArchivist API URL: " + Instance?.Configuration.TubeArchivistUrl);
logger.LogInformation("{Message}", "Pinging TubeArchivist API...");
@@ -173,6 +153,12 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata
private async void OnPlaybackProgress(object? sender, PlaybackProgressEventArgs eventArgs)
{
if (eventArgs == null || eventArgs.Item.Id == Guid.Empty)
{
Logger.LogDebug("Skipping progress synchronization: PlaybackProgress event triggered 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);
@@ -193,6 +179,12 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata
private async void OnWatchedStatusChange(object? sender, UserDataSaveEventArgs eventArgs)
{
if (eventArgs == null || eventArgs.Item.Id == Guid.Empty)
{
Logger.LogDebug("Skipping watched status synchronization: WatchedStatusChange event triggered with null or empty Guid.");
return;
}
var user = _userManager.GetUserById(eventArgs.UserId);
if (Configuration.JFTASync && user != null && Configuration.GetJFUsernamesToArray().Contains(user!.Username))
{
@@ -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)
{
@@ -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)
{
@@ -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)
{
@@ -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)
{
@@ -92,7 +92,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)
@@ -116,7 +116,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)
@@ -153,7 +153,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))
@@ -181,7 +181,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;
@@ -92,7 +92,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)
@@ -117,7 +117,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())
@@ -125,7 +125,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;
}
@@ -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<Video>(rawData);
}
@@ -134,11 +134,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)
{
@@ -179,7 +179,7 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.TubeArchivist
if (video != null)
{
progress = new Progress((long)video.Player.Position);
_logger.LogInformation("{Message}", $"Retrieved progress {video.Player.Position}");
_logger.LogDebug("{Message}", $"Retrieved progress {video.Player.Position}");
}
return progress;