Add options for adjusting credits length

This commit is contained in:
TwistedUmbrellaX 2024-04-13 14:07:12 -04:00
parent 91240ff437
commit 2442e579e0
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();
// 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 firstFrameTime = 0.0;

View File

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

View File

@ -96,7 +96,7 @@ public class PluginConfiguration : BasePluginConfiguration
/// <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.
/// </summary>
public int MaximumEpisodeCreditsDuration { get; set; } = 240;
public int MaximumCreditsDuration { get; set; } = 300;
/// <summary>
/// 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
</div>
<div class="fieldDescription">
Note: Not selecting at least one 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>
@ -136,6 +136,26 @@
</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>
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
@ -595,6 +615,8 @@
"AnalysisLengthLimit",
"MinimumIntroDuration",
"MaximumIntroDuration",
"MinimumCreditsDuration",
"MaximumCreditsDuration",
"EdlAction",
"ProcessPriority",
"ProcessThreads",

View File

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