From c106811e8e2c2f1e92e29492d1cbd7705b1378c1 Mon Sep 17 00:00:00 2001 From: TwistedUmbrellaX Date: Mon, 22 Apr 2024 11:00:19 -0400 Subject: [PATCH 1/4] Attempt to verify queue when finishing --- .../ScheduledTasks/BaseItemAnalyzerTask.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/BaseItemAnalyzerTask.cs b/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/BaseItemAnalyzerTask.cs index 73e3bbc..aa76baa 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/BaseItemAnalyzerTask.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/BaseItemAnalyzerTask.cs @@ -98,6 +98,13 @@ public class BaseItemAnalyzerTask { var writeEdl = false; + var totalRemaining = (Plugin.Instance!.TotalQueued * modeCount) - totalProcessed; + + if (totalRemaining >= queue.Count * modeCount) + { + // TODO: Handle items being added dynamically + } + // Since the first run of the task can run for multiple hours, ensure that none // of the current media items were deleted from Jellyfin since the task was started. var (episodes, requiredModes) = queueManager.VerifyQueue( From 85ea6de26c76eb97d04a759ca2bfe0fc51461866 Mon Sep 17 00:00:00 2001 From: TwistedUmbrellaX <1173913+AbandonedCart@users.noreply.github.com> Date: Tue, 23 Apr 2024 18:26:31 -0400 Subject: [PATCH 2/4] Update BaseItemAnalyzerTask.cs --- .../ScheduledTasks/BaseItemAnalyzerTask.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/BaseItemAnalyzerTask.cs b/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/BaseItemAnalyzerTask.cs index aa76baa..2870876 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/BaseItemAnalyzerTask.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/BaseItemAnalyzerTask.cs @@ -102,7 +102,13 @@ public class BaseItemAnalyzerTask if (totalRemaining >= queue.Count * modeCount) { - // TODO: Handle items being added dynamically + totalQueued = 0; + foreach (var kvp in Plugin.Instance!.QueuedMediaItems) + { + totalQueued += kvp.Value.Count; + } + + totalQueued *= _analysisModes.Count; } // Since the first run of the task can run for multiple hours, ensure that none From 28673a807ab5e5eeef3f341ce3d23df9694e6fc9 Mon Sep 17 00:00:00 2001 From: TwistedUmbrellaX Date: Thu, 25 Apr 2024 23:05:19 -0400 Subject: [PATCH 3/4] Use the minimum credit in chapter --- .../Analyzers/ChapterAnalyzer.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Analyzers/ChapterAnalyzer.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Analyzers/ChapterAnalyzer.cs index d5d09bc..1987ea9 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Analyzers/ChapterAnalyzer.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Analyzers/ChapterAnalyzer.cs @@ -91,7 +91,9 @@ public class ChapterAnalyzer : IMediaFileAnalyzer var config = Plugin.Instance?.Configuration ?? new Configuration.PluginConfiguration(); - var minDuration = config.MinimumIntroDuration; + var minDuration = mode == AnalysisMode.Introduction ? + config.MinimumIntroDuration : + config.MinimumCreditsDuration; int maxDuration = mode == AnalysisMode.Introduction ? config.MaximumIntroDuration : config.MaximumCreditsDuration; From d53e443925f3b7601e4637c624be1137952fe9d8 Mon Sep 17 00:00:00 2001 From: TwistedUmbrellaX Date: Thu, 25 Apr 2024 23:11:57 -0400 Subject: [PATCH 4/4] Update the queue when it changed --- .../ScheduledTasks/BaseItemAnalyzerTask.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/BaseItemAnalyzerTask.cs b/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/BaseItemAnalyzerTask.cs index 2870876..c0cbbb1 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/BaseItemAnalyzerTask.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/BaseItemAnalyzerTask.cs @@ -102,8 +102,9 @@ public class BaseItemAnalyzerTask if (totalRemaining >= queue.Count * modeCount) { + queue = new(Plugin.Instance!.QueuedMediaItems); totalQueued = 0; - foreach (var kvp in Plugin.Instance!.QueuedMediaItems) + foreach (var kvp in queue) { totalQueued += kvp.Value.Count; }