add options to disable scans of either intros or credits
This commit is contained in:
parent
3446c180aa
commit
2e67a4fb5e
@ -27,6 +27,16 @@ public class PluginConfiguration : BasePluginConfiguration
|
||||
/// </summary>
|
||||
public string SelectedLibraries { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether to scan for intros during a scheduled task.
|
||||
/// </summary>
|
||||
public bool DetectIntros { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether to scan for credits during a scheduled task.
|
||||
/// </summary>
|
||||
public bool DetectCredits { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether to analyze automatically, when new Items are added.
|
||||
/// </summary>
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
<body>
|
||||
<div id="TemplateConfigPage" data-role="page" class="page type-interior pluginConfigurationPage"
|
||||
data-require="emby-input,emby-button,emby-select,emby-checkbox">
|
||||
data-require="emby-input,emby-button,emby-select,emby-checkbox,emby-linkbutton">
|
||||
<div data-role="content">
|
||||
<style>
|
||||
summary {
|
||||
@ -27,6 +27,31 @@
|
||||
<fieldset class="verticalSection-extrabottompadding">
|
||||
<legend>Analysis</legend>
|
||||
|
||||
<div class="checkboxContainer checkboxContainer-withDescription">
|
||||
<label class="emby-checkbox-label">
|
||||
<input id="DetectIntros" type="checkbox" is="emby-checkbox" />
|
||||
<span>Detect Introductions</span>
|
||||
</label>
|
||||
|
||||
<div class="fieldDescription">
|
||||
This option enables scheduled introduction detection. Your videos will be scanned for introductions during a scheduled task.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="checkboxContainer checkboxContainer-withDescription">
|
||||
<label class="emby-checkbox-label">
|
||||
<input id="DetectCredits" type="checkbox" is="emby-checkbox" />
|
||||
<span>Detect Credits</span>
|
||||
</label>
|
||||
|
||||
<div class="fieldDescription">
|
||||
This option enables scheduled credit detection. Your videos will be scanned for credits during a scheduled task.
|
||||
</div>
|
||||
<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>.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="checkboxContainer checkboxContainer-withDescription">
|
||||
<label class="emby-checkbox-label">
|
||||
<input id="AutomaticAnalysis" type="checkbox" is="emby-checkbox" />
|
||||
@ -597,6 +622,8 @@
|
||||
]
|
||||
|
||||
var booleanConfigurationFields = [
|
||||
"DetectIntros",
|
||||
"DetectCredits",
|
||||
"AutomaticAnalysis",
|
||||
"AnalyzeSeasonZero",
|
||||
"RegenerateEdlFiles",
|
||||
|
@ -23,6 +23,7 @@ public class Entrypoint : IServerEntryPoint
|
||||
private readonly ILogger<Entrypoint> _logger;
|
||||
private readonly ILoggerFactory _loggerFactory;
|
||||
private Timer _queueTimer;
|
||||
private bool _analyzeAgain;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Entrypoint"/> class.
|
||||
@ -160,7 +161,7 @@ public class Entrypoint : IServerEntryPoint
|
||||
{
|
||||
if (Plugin.Instance!.AnalyzerTaskIsRunning)
|
||||
{
|
||||
return; // Don't do anything if a Analyzer is running
|
||||
_analyzeAgain = true; // Items added during a scan will be included later.
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -195,25 +196,37 @@ public class Entrypoint : IServerEntryPoint
|
||||
var progress = new Progress<double>();
|
||||
var cancellationToken = new CancellationToken(false);
|
||||
|
||||
// intro
|
||||
var introductionAnalyzer = new BaseItemAnalyzerTask(
|
||||
AnalysisMode.Introduction,
|
||||
_loggerFactory.CreateLogger<Entrypoint>(),
|
||||
_loggerFactory,
|
||||
_libraryManager);
|
||||
if (Plugin.Instance!.Configuration.DetectIntros)
|
||||
{
|
||||
var baseIntroAnalyzer = new BaseItemAnalyzerTask(
|
||||
AnalysisMode.Introduction,
|
||||
_loggerFactory.CreateLogger<DetectIntrosAndCreditsTask>(),
|
||||
_loggerFactory,
|
||||
_libraryManager);
|
||||
|
||||
introductionAnalyzer.AnalyzeItems(progress, cancellationToken);
|
||||
baseIntroAnalyzer.AnalyzeItems(progress, cancellationToken);
|
||||
}
|
||||
|
||||
// outro
|
||||
var creditsAnalyzer = new BaseItemAnalyzerTask(
|
||||
AnalysisMode.Credits,
|
||||
_loggerFactory.CreateLogger<Entrypoint>(),
|
||||
_loggerFactory,
|
||||
_libraryManager);
|
||||
if (Plugin.Instance!.Configuration.DetectCredits)
|
||||
{
|
||||
var baseCreditAnalyzer = new BaseItemAnalyzerTask(
|
||||
AnalysisMode.Credits,
|
||||
_loggerFactory.CreateLogger<DetectIntrosAndCreditsTask>(),
|
||||
_loggerFactory,
|
||||
_libraryManager);
|
||||
|
||||
creditsAnalyzer.AnalyzeItems(progress, cancellationToken);
|
||||
baseCreditAnalyzer.AnalyzeItems(progress, cancellationToken);
|
||||
}
|
||||
|
||||
Plugin.Instance!.AnalyzerTaskIsRunning = false;
|
||||
|
||||
// New item detected, start timer again
|
||||
if (_analyzeAgain)
|
||||
{
|
||||
_logger.LogInformation("Analyzing ended, but we need to analyze again!");
|
||||
_analyzeAgain = false;
|
||||
StartTimer();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -73,26 +73,27 @@ public class DetectIntrosAndCreditsTask : IScheduledTask
|
||||
Plugin.Instance!.AnalyzerTaskIsRunning = true;
|
||||
}
|
||||
|
||||
// intro
|
||||
var baseIntroAnalyzer = new BaseItemAnalyzerTask(
|
||||
AnalysisMode.Introduction,
|
||||
_loggerFactory.CreateLogger<DetectIntrosAndCreditsTask>(),
|
||||
_loggerFactory,
|
||||
_libraryManager);
|
||||
if (Plugin.Instance!.Configuration.DetectIntros)
|
||||
{
|
||||
var baseIntroAnalyzer = new BaseItemAnalyzerTask(
|
||||
AnalysisMode.Introduction,
|
||||
_loggerFactory.CreateLogger<DetectIntrosAndCreditsTask>(),
|
||||
_loggerFactory,
|
||||
_libraryManager);
|
||||
|
||||
baseIntroAnalyzer.AnalyzeItems(progress, cancellationToken);
|
||||
baseIntroAnalyzer.AnalyzeItems(progress, cancellationToken);
|
||||
}
|
||||
|
||||
// reset progress
|
||||
progress.Report(0);
|
||||
if (Plugin.Instance!.Configuration.DetectCredits)
|
||||
{
|
||||
var baseCreditAnalyzer = new BaseItemAnalyzerTask(
|
||||
AnalysisMode.Credits,
|
||||
_loggerFactory.CreateLogger<DetectIntrosAndCreditsTask>(),
|
||||
_loggerFactory,
|
||||
_libraryManager);
|
||||
|
||||
// outro
|
||||
var baseCreditAnalyzer = new BaseItemAnalyzerTask(
|
||||
AnalysisMode.Credits,
|
||||
_loggerFactory.CreateLogger<DetectIntrosAndCreditsTask>(),
|
||||
_loggerFactory,
|
||||
_libraryManager);
|
||||
|
||||
baseCreditAnalyzer.AnalyzeItems(progress, cancellationToken);
|
||||
baseCreditAnalyzer.AnalyzeItems(progress, cancellationToken);
|
||||
}
|
||||
|
||||
Plugin.Instance!.AnalyzerTaskIsRunning = false;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user