Add options for adjusting credits length

This commit is contained in:
TwistedUmbrellaX 2024-04-13 14:07:12 -04:00
parent de956c8081
commit 54f69e7e09
5 changed files with 27 additions and 5 deletions

View File

@ -79,7 +79,7 @@ public class BlackFrameAnalyzer : IMediaFileAnalyzer
var config = Plugin.Instance?.Configuration ?? new Configuration.PluginConfiguration(); var config = Plugin.Instance?.Configuration ?? new Configuration.PluginConfiguration();
// Start by analyzing the last N minutes of the file. // Start by analyzing the last N minutes of the file.
var start = TimeSpan.FromSeconds(config.MaximumEpisodeCreditsDuration); var start = TimeSpan.FromSeconds(config.MaximumCreditsDuration);
var end = TimeSpan.FromSeconds(config.MinimumCreditsDuration); var end = TimeSpan.FromSeconds(config.MinimumCreditsDuration);
var firstFrameTime = 0.0; var firstFrameTime = 0.0;

View File

@ -94,7 +94,7 @@ public class ChapterAnalyzer : IMediaFileAnalyzer
var minDuration = config.MinimumIntroDuration; var minDuration = config.MinimumIntroDuration;
int maxDuration = mode == AnalysisMode.Introduction ? int maxDuration = mode == AnalysisMode.Introduction ?
config.MaximumIntroDuration : config.MaximumIntroDuration :
config.MaximumEpisodeCreditsDuration; config.MaximumCreditsDuration;
if (chapters.Count == 0) if (chapters.Count == 0)
{ {

View File

@ -96,7 +96,7 @@ public class PluginConfiguration : BasePluginConfiguration
/// <summary> /// <summary>
/// Gets or sets the upper limit (in seconds) on the length of each episode's audio track that will be analyzed when searching for ending credits. /// Gets or sets the upper limit (in seconds) on the length of each episode's audio track that will be analyzed when searching for ending credits.
/// </summary> /// </summary>
public int MaximumEpisodeCreditsDuration { get; set; } = 600; public int MaximumCreditsDuration { get; set; } = 300;
/// <summary> /// <summary>
/// Gets or sets the minimum percentage of a frame that must consist of black pixels before it is considered a black frame. /// Gets or sets the minimum percentage of a frame that must consist of black pixels before it is considered a black frame.

View File

@ -48,7 +48,7 @@
If enabled, credits will be automatically analyzed for new media If enabled, credits will be automatically analyzed for new media
</div> </div>
<div class="fieldDescription"> <div class="fieldDescription">
Note: Selecting neither Intro nor Credit Detection will disable automatic scans. To configure the scheduled task, see <a is="emby-linkbutton" class="button-link" href="scheduledtasks.html">scheduled tasks</a>. Note: Not selecting at least one automatic detection type will disable automatic scans. To configure the scheduled task, see <a is="emby-linkbutton" class="button-link" href="scheduledtasks.html">scheduled tasks</a>.
</div> </div>
</div> </div>
@ -136,6 +136,26 @@
</div> </div>
</div> </div>
<div class="inputContainer">
<label class="inputLabel inputLabelUnfocused" for="MinimumCreditsDuration">
Minimum credits duration (in seconds)
</label>
<input id="MinimumCreditsDuration" type="number" is="emby-input" min="1" />
<div class="fieldDescription">
Similar sounding audio which is shorter than this duration will not be considered credits.
</div>
</div>
<div class="inputContainer">
<label class="inputLabel inputLabelUnfocused" for="MaximumEpisodeCreditsDuration">
Maximum credits duration (in seconds)
</label>
<input id="MaximumEpisodeCreditsDuration" type="number" is="emby-input" min="1" />
<div class="fieldDescription">
Similar sounding audio which is longer than this duration will not be considered credits.
</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
@ -619,6 +639,8 @@
"AnalysisLengthLimit", "AnalysisLengthLimit",
"MinimumIntroDuration", "MinimumIntroDuration",
"MaximumIntroDuration", "MaximumIntroDuration",
"MinimumCreditsDuration",
"MaximumCreditsDuration",
"EdlAction", "EdlAction",
"ProcessPriority", "ProcessPriority",
"ProcessThreads", "ProcessThreads",

View File

@ -198,7 +198,7 @@ public class QueueManager
_queuedEpisodes.TryAdd(episode.SeasonId, new List<QueuedEpisode>()); _queuedEpisodes.TryAdd(episode.SeasonId, new List<QueuedEpisode>());
// Queue the episode for analysis // Queue the episode for analysis
var maxCreditsDuration = Plugin.Instance!.Configuration.MaximumEpisodeCreditsDuration; var maxCreditsDuration = Plugin.Instance!.Configuration.MaximumCreditsDuration;
_queuedEpisodes[episode.SeasonId].Add(new QueuedEpisode() _queuedEpisodes[episode.SeasonId].Add(new QueuedEpisode()
{ {
SeriesName = episode.SeriesName, SeriesName = episode.SeriesName,