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>
|
/// </summary>
|
||||||
public string SelectedLibraries { get; set; } = string.Empty;
|
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>
|
/// <summary>
|
||||||
/// Gets or sets a value indicating whether to analyze automatically, when new Items are added.
|
/// Gets or sets a value indicating whether to analyze automatically, when new Items are added.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div id="TemplateConfigPage" data-role="page" class="page type-interior pluginConfigurationPage"
|
<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">
|
<div data-role="content">
|
||||||
<style>
|
<style>
|
||||||
summary {
|
summary {
|
||||||
@ -27,6 +27,31 @@
|
|||||||
<fieldset class="verticalSection-extrabottompadding">
|
<fieldset class="verticalSection-extrabottompadding">
|
||||||
<legend>Analysis</legend>
|
<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">
|
<div class="checkboxContainer checkboxContainer-withDescription">
|
||||||
<label class="emby-checkbox-label">
|
<label class="emby-checkbox-label">
|
||||||
<input id="AutomaticAnalysis" type="checkbox" is="emby-checkbox" />
|
<input id="AutomaticAnalysis" type="checkbox" is="emby-checkbox" />
|
||||||
@ -597,6 +622,8 @@
|
|||||||
]
|
]
|
||||||
|
|
||||||
var booleanConfigurationFields = [
|
var booleanConfigurationFields = [
|
||||||
|
"DetectIntros",
|
||||||
|
"DetectCredits",
|
||||||
"AutomaticAnalysis",
|
"AutomaticAnalysis",
|
||||||
"AnalyzeSeasonZero",
|
"AnalyzeSeasonZero",
|
||||||
"RegenerateEdlFiles",
|
"RegenerateEdlFiles",
|
||||||
|
@ -23,6 +23,7 @@ public class Entrypoint : IServerEntryPoint
|
|||||||
private readonly ILogger<Entrypoint> _logger;
|
private readonly ILogger<Entrypoint> _logger;
|
||||||
private readonly ILoggerFactory _loggerFactory;
|
private readonly ILoggerFactory _loggerFactory;
|
||||||
private Timer _queueTimer;
|
private Timer _queueTimer;
|
||||||
|
private bool _analyzeAgain;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="Entrypoint"/> class.
|
/// Initializes a new instance of the <see cref="Entrypoint"/> class.
|
||||||
@ -160,7 +161,7 @@ public class Entrypoint : IServerEntryPoint
|
|||||||
{
|
{
|
||||||
if (Plugin.Instance!.AnalyzerTaskIsRunning)
|
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
|
else
|
||||||
{
|
{
|
||||||
@ -195,25 +196,37 @@ public class Entrypoint : IServerEntryPoint
|
|||||||
var progress = new Progress<double>();
|
var progress = new Progress<double>();
|
||||||
var cancellationToken = new CancellationToken(false);
|
var cancellationToken = new CancellationToken(false);
|
||||||
|
|
||||||
// intro
|
if (Plugin.Instance!.Configuration.DetectIntros)
|
||||||
var introductionAnalyzer = new BaseItemAnalyzerTask(
|
{
|
||||||
|
var baseIntroAnalyzer = new BaseItemAnalyzerTask(
|
||||||
AnalysisMode.Introduction,
|
AnalysisMode.Introduction,
|
||||||
_loggerFactory.CreateLogger<Entrypoint>(),
|
_loggerFactory.CreateLogger<DetectIntrosAndCreditsTask>(),
|
||||||
_loggerFactory,
|
_loggerFactory,
|
||||||
_libraryManager);
|
_libraryManager);
|
||||||
|
|
||||||
introductionAnalyzer.AnalyzeItems(progress, cancellationToken);
|
baseIntroAnalyzer.AnalyzeItems(progress, cancellationToken);
|
||||||
|
}
|
||||||
|
|
||||||
// outro
|
if (Plugin.Instance!.Configuration.DetectCredits)
|
||||||
var creditsAnalyzer = new BaseItemAnalyzerTask(
|
{
|
||||||
|
var baseCreditAnalyzer = new BaseItemAnalyzerTask(
|
||||||
AnalysisMode.Credits,
|
AnalysisMode.Credits,
|
||||||
_loggerFactory.CreateLogger<Entrypoint>(),
|
_loggerFactory.CreateLogger<DetectIntrosAndCreditsTask>(),
|
||||||
_loggerFactory,
|
_loggerFactory,
|
||||||
_libraryManager);
|
_libraryManager);
|
||||||
|
|
||||||
creditsAnalyzer.AnalyzeItems(progress, cancellationToken);
|
baseCreditAnalyzer.AnalyzeItems(progress, cancellationToken);
|
||||||
|
}
|
||||||
|
|
||||||
Plugin.Instance!.AnalyzerTaskIsRunning = false;
|
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>
|
/// <summary>
|
||||||
|
@ -73,7 +73,8 @@ public class DetectIntrosAndCreditsTask : IScheduledTask
|
|||||||
Plugin.Instance!.AnalyzerTaskIsRunning = true;
|
Plugin.Instance!.AnalyzerTaskIsRunning = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// intro
|
if (Plugin.Instance!.Configuration.DetectIntros)
|
||||||
|
{
|
||||||
var baseIntroAnalyzer = new BaseItemAnalyzerTask(
|
var baseIntroAnalyzer = new BaseItemAnalyzerTask(
|
||||||
AnalysisMode.Introduction,
|
AnalysisMode.Introduction,
|
||||||
_loggerFactory.CreateLogger<DetectIntrosAndCreditsTask>(),
|
_loggerFactory.CreateLogger<DetectIntrosAndCreditsTask>(),
|
||||||
@ -81,11 +82,10 @@ public class DetectIntrosAndCreditsTask : IScheduledTask
|
|||||||
_libraryManager);
|
_libraryManager);
|
||||||
|
|
||||||
baseIntroAnalyzer.AnalyzeItems(progress, cancellationToken);
|
baseIntroAnalyzer.AnalyzeItems(progress, cancellationToken);
|
||||||
|
}
|
||||||
|
|
||||||
// reset progress
|
if (Plugin.Instance!.Configuration.DetectCredits)
|
||||||
progress.Report(0);
|
{
|
||||||
|
|
||||||
// outro
|
|
||||||
var baseCreditAnalyzer = new BaseItemAnalyzerTask(
|
var baseCreditAnalyzer = new BaseItemAnalyzerTask(
|
||||||
AnalysisMode.Credits,
|
AnalysisMode.Credits,
|
||||||
_loggerFactory.CreateLogger<DetectIntrosAndCreditsTask>(),
|
_loggerFactory.CreateLogger<DetectIntrosAndCreditsTask>(),
|
||||||
@ -93,6 +93,7 @@ public class DetectIntrosAndCreditsTask : IScheduledTask
|
|||||||
_libraryManager);
|
_libraryManager);
|
||||||
|
|
||||||
baseCreditAnalyzer.AnalyzeItems(progress, cancellationToken);
|
baseCreditAnalyzer.AnalyzeItems(progress, cancellationToken);
|
||||||
|
}
|
||||||
|
|
||||||
Plugin.Instance!.AnalyzerTaskIsRunning = false;
|
Plugin.Instance!.AnalyzerTaskIsRunning = false;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user