Allow customizing analysis settings
This commit is contained in:
parent
ad3a422047
commit
055a851e27
@ -14,6 +14,8 @@ public class PluginConfiguration : BasePluginConfiguration
|
||||
{
|
||||
}
|
||||
|
||||
// ===== Analysis settings =====
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether the episode's fingerprint should be cached to the filesystem.
|
||||
/// </summary>
|
||||
@ -24,6 +26,18 @@ public class PluginConfiguration : BasePluginConfiguration
|
||||
/// </summary>
|
||||
public int MaxParallelism { get; set; } = 2;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the percentage of each episode's audio track to analyze.
|
||||
/// </summary>
|
||||
public int AnalysisPercent { get; set; } = 25;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the upper limit (in minutes) on the length of each episode's audio track that will be analyzed.
|
||||
/// </summary>
|
||||
public int AnalysisLengthLimit { get; set; } = 10;
|
||||
|
||||
// ===== Playback settings =====
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether introductions should be automatically skipped.
|
||||
/// </summary>
|
||||
|
@ -37,6 +37,45 @@
|
||||
Maximum degree of parallelism to use when analyzing episodes.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<details>
|
||||
<summary>Modify introduction requirements</summary>
|
||||
|
||||
<div class="inputContainer">
|
||||
<label class="inputLabel inputLabelUnfocused" for="MaxParallelism">
|
||||
Percent of audio to analyze
|
||||
</label>
|
||||
<input id="AnalysisPercent" type="number" is="emby-input" min="1" max="90" />
|
||||
<div class="fieldDescription">
|
||||
Analysis will be limited to this percentage of each episode's audio. For example, a
|
||||
value of 25 (the default) will limit analysis to the first quarter of each episode.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="inputContainer">
|
||||
<label class="inputLabel inputLabelUnfocused" for="MaxParallelism">
|
||||
Maximum runtime of audio to analyze (in minutes)
|
||||
</label>
|
||||
<input id="AnalysisLengthLimit" type="number" is="emby-input" min="1" />
|
||||
<div class="fieldDescription">
|
||||
Analysis will be limited to this amount of each episode's audio. For example, a
|
||||
value of 10 (the default) will limit analysis to the first 10 minutes of each
|
||||
episode.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
The amount of each episode's audio that will be analyzed is determined by these two
|
||||
settings. The minimum of (episode duration * percent, maximum runtime) is the amount of
|
||||
audio that will be analyzed. <br />
|
||||
|
||||
If these settings are changed after analyzing your media, the cached fingerprints and
|
||||
introduction timestamps for each season you want to analyze with the modified settings
|
||||
will have to be deleted.
|
||||
</p>
|
||||
|
||||
<strong>Increasing these settings will cause episode analysis to take much longer.</strong>
|
||||
</details>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="verticalSection-extrabottompadding">
|
||||
@ -439,6 +478,9 @@
|
||||
document.querySelector('#AutoSkip').checked = config.AutoSkip;
|
||||
document.querySelector('#MaxParallelism').value = config.MaxParallelism;
|
||||
|
||||
document.querySelector('#AnalysisPercent').value = config.AnalysisPercent;
|
||||
document.querySelector('#AnalysisLengthLimit').value = config.AnalysisLengthLimit;
|
||||
|
||||
document.querySelector('#CacheFingerprints').checked = config.CacheFingerprints;
|
||||
document.querySelector('#ShowPromptAdjustment').value = config.ShowPromptAdjustment;
|
||||
document.querySelector('#HidePromptAdjustment').value = config.HidePromptAdjustment;
|
||||
@ -454,6 +496,9 @@
|
||||
config.AutoSkip = document.querySelector('#AutoSkip').checked;
|
||||
config.MaxParallelism = document.querySelector('#MaxParallelism').value;
|
||||
|
||||
config.AnalysisPercent = document.querySelector('#AnalysisPercent').value;
|
||||
config.AnalysisLengthLimit = document.querySelector('#AnalysisLengthLimit').value;
|
||||
|
||||
config.CacheFingerprints = document.querySelector('#CacheFingerprints').checked;
|
||||
config.ShowPromptAdjustment = document.querySelector("#ShowPromptAdjustment").value;
|
||||
config.HidePromptAdjustment = document.querySelector("#HidePromptAdjustment").value;
|
||||
|
@ -17,6 +17,8 @@ public class QueueManager
|
||||
private ILibraryManager _libraryManager;
|
||||
private ILogger<QueueManager> _logger;
|
||||
|
||||
private double analysisPercent;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="QueueManager"/> class.
|
||||
/// </summary>
|
||||
@ -42,6 +44,18 @@ public class QueueManager
|
||||
|
||||
Plugin.Instance!.AnalysisQueue.Clear();
|
||||
|
||||
// If analysis settings have been changed from the default, log the modified settings.
|
||||
var config = Plugin.Instance!.Configuration;
|
||||
analysisPercent = Convert.ToDouble(config.AnalysisPercent) / 100;
|
||||
|
||||
if (config.AnalysisLengthLimit != 10 || config.AnalysisPercent != 25)
|
||||
{
|
||||
_logger.LogDebug(
|
||||
"Introduction scan is limited to the first {Percent}% or the first {Minutes} minutes of each episode (whichever is smaller)",
|
||||
config.AnalysisPercent,
|
||||
config.AnalysisLengthLimit);
|
||||
}
|
||||
|
||||
// For all TV show libraries, enqueue all contained items.
|
||||
foreach (var folder in _libraryManager.GetVirtualFolders())
|
||||
{
|
||||
@ -132,14 +146,17 @@ public class QueueManager
|
||||
Plugin.Instance.AnalysisQueue[episode.SeasonId] = new List<QueuedEpisode>();
|
||||
}
|
||||
|
||||
// Only fingerprint up to 25% of the episode and at most 10 minutes.
|
||||
var config = Plugin.Instance!.Configuration;
|
||||
|
||||
// Limit analysis to the first X% of the episode and at most Y minutes.
|
||||
// X and Y default to 25% and 10 minutes.
|
||||
var duration = TimeSpan.FromTicks(episode.RunTimeTicks ?? 0).TotalSeconds;
|
||||
if (duration >= 5 * 60)
|
||||
{
|
||||
duration /= 4;
|
||||
duration *= analysisPercent;
|
||||
}
|
||||
|
||||
duration = Math.Min(duration, 10 * 60);
|
||||
duration = Math.Min(duration, 60 * config.AnalysisLengthLimit);
|
||||
|
||||
Plugin.Instance.AnalysisQueue[episode.SeasonId].Add(new QueuedEpisode()
|
||||
{
|
||||
|
@ -23,6 +23,7 @@ Plugin versions v0.1.0 and older require `fpcalc` to be installed.
|
||||
Show introductions will only be detected if they are:
|
||||
|
||||
* Located within the first 25% of an episode, or the first 10 minutes, whichever is smaller
|
||||
* Both of these settings are customizable
|
||||
* At least 20 seconds long
|
||||
|
||||
## Step 1: Optional: use the modified web interface
|
||||
|
Loading…
x
Reference in New Issue
Block a user