From c937e28d458b085f56a950e180c3d34d523e7ed1 Mon Sep 17 00:00:00 2001 From: ConfusedPolarBear <33811686+ConfusedPolarBear@users.noreply.github.com> Date: Sat, 3 Sep 2022 00:39:35 -0500 Subject: [PATCH] Add maximum introduction duration --- .../Configuration/PluginConfiguration.cs | 5 +++++ .../Configuration/configPage.html | 12 ++++++++++++ .../ScheduledTasks/AnalyzeEpisodesTask.cs | 8 ++++++-- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/PluginConfiguration.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/PluginConfiguration.cs index 46d3652..837370a 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/PluginConfiguration.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/PluginConfiguration.cs @@ -62,6 +62,11 @@ public class PluginConfiguration : BasePluginConfiguration /// public int MinimumIntroDuration { get; set; } = 15; + /// + /// Gets or sets the maximum length of similar audio that will be considered an introduction. + /// + public int MaximumIntroDuration { get; set; } = 120; + // ===== Playback settings ===== /// diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/configPage.html b/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/configPage.html index 99981cf..4f51047 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/configPage.html +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/configPage.html @@ -139,6 +139,17 @@ +
+ + +
+ Similar sounding audio which is longer than this duration will not be considered an + introduction. +
+
+

The amount of each episode's audio that will be analyzed is determined using both the percentage of audio and maximum runtime of audio to analyze. The minimum of @@ -373,6 +384,7 @@ "AnalysisPercent", "AnalysisLengthLimit", "MinimumIntroDuration", + "MaximumIntroDuration", "EdlAction", // playback "ShowPromptAdjustment", diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/AnalyzeEpisodesTask.cs b/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/AnalyzeEpisodesTask.cs index f3aef75..328e7b8 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/AnalyzeEpisodesTask.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/AnalyzeEpisodesTask.cs @@ -304,8 +304,12 @@ public class AnalyzeEpisodesTask : IScheduledTask remainingEpisode.EpisodeId, fingerprintCache[remainingEpisode.EpisodeId]); - // If one of the intros isn't valid, ignore this comparison result. - if (!currentIntro.Valid) + // Ignore this comparison result if: + // - one of the intros isn't valid, or + // - the introduction exceeds the configured limit + if ( + !remainingIntro.Valid || + remainingIntro.Duration > Plugin.Instance!.Configuration.MaximumIntroDuration) { continue; }