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> /// </summary>
public int MinimumIntroDuration { get; set; } = 15; 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 ===== // ===== Playback settings =====
/// <summary> /// <summary>

View File

@ -139,6 +139,17 @@
</div> </div>
</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> <p>
The amount of each episode's audio that will be analyzed is determined using both 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 the percentage of audio and maximum runtime of audio to analyze. The minimum of
@ -373,6 +384,7 @@
"AnalysisPercent", "AnalysisPercent",
"AnalysisLengthLimit", "AnalysisLengthLimit",
"MinimumIntroDuration", "MinimumIntroDuration",
"MaximumIntroDuration",
"EdlAction", "EdlAction",
// playback // playback
"ShowPromptAdjustment", "ShowPromptAdjustment",

View File

@ -304,8 +304,12 @@ public class AnalyzeEpisodesTask : IScheduledTask
remainingEpisode.EpisodeId, remainingEpisode.EpisodeId,
fingerprintCache[remainingEpisode.EpisodeId]); fingerprintCache[remainingEpisode.EpisodeId]);
// If one of the intros isn't valid, ignore this comparison result. // Ignore this comparison result if:
if (!currentIntro.Valid) // - one of the intros isn't valid, or
// - the introduction exceeds the configured limit
if (
!remainingIntro.Valid ||
remainingIntro.Duration > Plugin.Instance!.Configuration.MaximumIntroDuration)
{ {
continue; continue;
} }