Add support for limiting analysis by library name

Closes #5, #37
This commit is contained in:
ConfusedPolarBear 2022-06-27 00:21:30 -05:00
parent ad3a422047
commit add5a46576
4 changed files with 42 additions and 2 deletions

View File

@ -24,6 +24,11 @@ public class PluginConfiguration : BasePluginConfiguration
/// </summary>
public int MaxParallelism { get; set; } = 2;
/// <summary>
/// Gets or sets the comma separated list of library names to analyze. If empty, all libraries will be analyzed.
/// </summary>
public string SelectedLibraries { get; set; } = string.Empty;
/// <summary>
/// Gets or sets a value indicating whether introductions should be automatically skipped.
/// </summary>

View File

@ -37,6 +37,17 @@
Maximum degree of parallelism to use when analyzing episodes.
</div>
</div>
<div class="inputContainer">
<label class="inputLabel inputLabelUnfocused" for="SelectedLibraries">
Limit analysis to the following libraries
</label>
<input id="SelectedLibraries" type="text" is="emby-input" />
<div class="fieldDescription">
Enter the names of libraries to analyze, separated by commas. If this field is left
blank, all libraries on the server containing television episodes will be analyzed.
</div>
</div>
</fieldset>
<fieldset class="verticalSection-extrabottompadding">
@ -438,6 +449,7 @@
ApiClient.getPluginConfiguration("c83d86bb-a1e0-4c35-a113-e2101cf4ee6b").then(function (config) {
document.querySelector('#AutoSkip').checked = config.AutoSkip;
document.querySelector('#MaxParallelism').value = config.MaxParallelism;
document.querySelector('#SelectedLibraries').value = config.SelectedLibraries;
document.querySelector('#CacheFingerprints').checked = config.CacheFingerprints;
document.querySelector('#ShowPromptAdjustment').value = config.ShowPromptAdjustment;
@ -453,6 +465,7 @@
ApiClient.getPluginConfiguration("c83d86bb-a1e0-4c35-a113-e2101cf4ee6b").then(function (config) {
config.AutoSkip = document.querySelector('#AutoSkip').checked;
config.MaxParallelism = document.querySelector('#MaxParallelism').value;
config.SelectedLibraries = document.querySelector('#SelectedLibraries').value;
config.CacheFingerprints = document.querySelector('#CacheFingerprints').checked;
config.ShowPromptAdjustment = document.querySelector("#ShowPromptAdjustment").value;

View File

@ -2,6 +2,7 @@ namespace ConfusedPolarBear.Plugin.IntroSkipper;
using System;
using System.Collections.Generic;
using System.Linq;
using Jellyfin.Data.Enums;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.TV;
@ -42,7 +43,21 @@ public class QueueManager
Plugin.Instance!.AnalysisQueue.Clear();
// For all TV show libraries, enqueue all contained items.
// Get the list of library names which have been selected for analysis, ignoring whitespace and empty entries.
var selected = Plugin.Instance!.Configuration.SelectedLibraries
.Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries)
.ToList();
if (selected.Count > 0)
{
_logger.LogInformation("Limiting analysis to the following libraries: {Selected}", selected);
}
else
{
_logger.LogDebug("Not limiting analysis by library name");
}
// For all selected TV show libraries, enqueue all contained items.
foreach (var folder in _libraryManager.GetVirtualFolders())
{
if (folder.CollectionType != CollectionTypeOptions.TvShows)
@ -50,6 +65,13 @@ public class QueueManager
continue;
}
// If libraries have been selected for analysis, ensure this library was selected.
if (selected.Count > 0 && !selected.Contains(folder.Name))
{
_logger.LogDebug("Not analyzing library \"{Name}\"", folder.Name);
continue;
}
_logger.LogInformation(
"Running enqueue of items in library {Name} ({ItemId})",
folder.Name,

View File

@ -132,7 +132,7 @@ public class FingerprinterTask : IScheduledTask
if (queue.Count == 0)
{
throw new FingerprintException(
"No episodes to analyze: either no show libraries are defined or ffmpeg could not be found");
"No episodes to analyze. If you are limiting the list of libraries to analyze, check that all library names have been spelled correctly.");
}
// Include the previously processed episodes in the percentage reported to the UI.