From de60fd236f63596f9e05885ebc49e76582679422 Mon Sep 17 00:00:00 2001 From: TwistedUmbrellaX Date: Sun, 14 Apr 2024 10:20:18 -0400 Subject: [PATCH] Still cancel automation for scheduled The priority should starts at scheduled task (a full scan), but automatic scans will add items to them. Library scan is next, but again it should allow appending. Item scans should be last and get overridden by the other two. --- .../ScheduledTasks/DetectCreditsTask.cs | 5 +++++ .../ScheduledTasks/DetectIntrosCreditsTask.cs | 5 +++++ .../ScheduledTasks/DetectIntrosTask.cs | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/DetectCreditsTask.cs b/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/DetectCreditsTask.cs index 2402976..bacb457 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/DetectCreditsTask.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/DetectCreditsTask.cs @@ -74,6 +74,11 @@ public class DetectCreditsTask : IScheduledTask { return Task.CompletedTask; } + else if (Plugin.Instance!.AnalyzerTaskIsRunning && Entrypoint.AutomaticTaskState == TaskState.Running) + { + _logger.LogInformation("Automatic Task is {0} and will be canceled.", Entrypoint.AutomaticTaskState); + Entrypoint.CancelAutomaticTask(); + } _logger.LogInformation("Scheduled Task is starting"); Plugin.Instance!.AnalyzerTaskIsRunning = true; diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/DetectIntrosCreditsTask.cs b/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/DetectIntrosCreditsTask.cs index 89edea1..f58472c 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/DetectIntrosCreditsTask.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/DetectIntrosCreditsTask.cs @@ -73,6 +73,11 @@ public class DetectIntrosCreditsTask : IScheduledTask { return Task.CompletedTask; } + else if (Plugin.Instance!.AnalyzerTaskIsRunning && Entrypoint.AutomaticTaskState == TaskState.Running) + { + _logger.LogInformation("Automatic Task is {0} and will be canceled.", Entrypoint.AutomaticTaskState); + Entrypoint.CancelAutomaticTask(); + } _logger.LogInformation("Scheduled Task is starting"); Plugin.Instance!.AnalyzerTaskIsRunning = true; diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/DetectIntrosTask.cs b/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/DetectIntrosTask.cs index bbf98ec..c92f800 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/DetectIntrosTask.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/DetectIntrosTask.cs @@ -73,6 +73,11 @@ public class DetectIntrosTask : IScheduledTask { return Task.CompletedTask; } + else if (Plugin.Instance!.AnalyzerTaskIsRunning && Entrypoint.AutomaticTaskState == TaskState.Running) + { + _logger.LogInformation("Automatic Task is {0} and will be canceled.", Entrypoint.AutomaticTaskState); + Entrypoint.CancelAutomaticTask(); + } _logger.LogInformation("Scheduled Task is starting"); Plugin.Instance!.AnalyzerTaskIsRunning = true;