Add maximum introduction duration

This commit is contained in:
ConfusedPolarBear 2022-09-03 00:39:35 -05:00
parent 7612e6cdaf
commit c937e28d45
3 changed files with 23 additions and 2 deletions

View File

@ -62,6 +62,11 @@ public class PluginConfiguration : BasePluginConfiguration
/// </summary>
public int MinimumIntroDuration { get; set; } = 15;
/// <summary>
/// Gets or sets the maximum length of similar audio that will be considered an introduction.
/// </summary>
public int MaximumIntroDuration { get; set; } = 120;
// ===== Playback settings =====
/// <summary>

View File

@ -139,6 +139,17 @@
</div>
</div>
<div class="inputContainer">
<label class="inputLabel inputLabelUnfocused" for="MaximumIntroDuration">
Maximum introduction duration (in seconds)
</label>
<input id="MaximumIntroDuration" type="number" is="emby-input" min="1" />
<div class="fieldDescription">
Similar sounding audio which is longer than this duration will not be considered an
introduction.
</div>
</div>
<p>
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",

View File

@ -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;
}