From ca47492b9bd74d1b36d7fb2298dfbed841e8d99f Mon Sep 17 00:00:00 2001 From: TwistedUmbrellaX Date: Sun, 31 Mar 2024 07:05:20 -0400 Subject: [PATCH] Split progress bar for split tasks This replaces the jarring effect of resetting the bar halfway through two concurrent scans. --- .../ScheduledTasks/BaseItemAnalyzerTask.cs | 9 ++++++++- .../ScheduledTasks/DetectIntrosCreditsTask.cs | 3 --- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/BaseItemAnalyzerTask.cs b/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/BaseItemAnalyzerTask.cs index 3ab7816..f80f0a4 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/BaseItemAnalyzerTask.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/BaseItemAnalyzerTask.cs @@ -146,7 +146,14 @@ public class BaseItemAnalyzerTask EdlManager.UpdateEDLFiles(episodes); } - progress.Report((totalProcessed * 100) / totalQueued); + if (_analysisMode == AnalysisMode.Introduction) + { + progress.Report(((totalProcessed * 100) / totalQueued) / 2); + } + else + { + progress.Report((((totalProcessed * 100) / totalQueued) / 2) + 50); + } }); if ( diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/DetectIntrosCreditsTask.cs b/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/DetectIntrosCreditsTask.cs index 69c6632..913d87c 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/DetectIntrosCreditsTask.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/DetectIntrosCreditsTask.cs @@ -81,9 +81,6 @@ public class DetectIntrosCreditsTask : IScheduledTask baseIntroAnalyzer.AnalyzeItems(progress, cancellationToken); - // reset progress - progress.Report(0); - var baseCreditAnalyzer = new BaseItemAnalyzerTask( AnalysisMode.Credits, _loggerFactory.CreateLogger(),