diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/PluginConfiguration.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/PluginConfiguration.cs index 5a31357..581d8f9 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/PluginConfiguration.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/PluginConfiguration.cs @@ -24,6 +24,11 @@ public class PluginConfiguration : BasePluginConfiguration /// public int MaxParallelism { get; set; } = 2; + /// + /// Gets or sets the comma separated list of library names to analyze. If empty, all libraries will be analyzed. + /// + public string SelectedLibraries { get; set; } = string.Empty; + /// /// Gets or sets a value indicating whether introductions should be automatically skipped. /// diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/configPage.html b/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/configPage.html index 54d8930..c36cee8 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/configPage.html +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/configPage.html @@ -37,6 +37,17 @@ Maximum degree of parallelism to use when analyzing episodes. + +
+ + +
+ 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. +
+
@@ -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; diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/QueueManager.cs b/ConfusedPolarBear.Plugin.IntroSkipper/QueueManager.cs index 3996fbc..3f64f6e 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/QueueManager.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/QueueManager.cs @@ -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, diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/FingerprinterTask.cs b/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/FingerprinterTask.cs index 0520f20..ff79c54 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/FingerprinterTask.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/FingerprinterTask.cs @@ -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.