diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/PluginConfiguration.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/PluginConfiguration.cs index 33b5770..5454f84 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/PluginConfiguration.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/PluginConfiguration.cs @@ -10,6 +10,8 @@ namespace ConfusedPolarBear.Plugin.IntroSkipper.Configuration; /// public class PluginConfiguration : BasePluginConfiguration { + private bool? _selectAllLibraries; + /// /// Initializes a new instance of the class. /// @@ -25,10 +27,19 @@ 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. + /// Gets or sets the comma separated list of library names to analyze. /// public string SelectedLibraries { get; set; } = string.Empty; + /// + /// Gets or sets a value indicating whether all libraries should be analyzed. + /// + public bool SelectAllLibraries + { + get => _selectAllLibraries ?? string.IsNullOrEmpty(SelectedLibraries); + set => _selectAllLibraries = value; + } + /// /// Gets or sets the list of client to auto skip for. /// diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/configPage.html b/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/configPage.html index 5f5ce68..18e6615 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/configPage.html +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/configPage.html @@ -77,17 +77,21 @@ -
-
-

Limit analysis to the following libraries

-
+
+ + +
+
+

Limit analysis to the following libraries

+
+
+ +
-
- Selected libraries will be analyzed. If none are selected, all TV show and mixed libraries will be analyzed. -
- -
@@ -739,6 +743,7 @@ "AutoDetectIntros", "AutoDetectCredits", "AnalyzeSeasonZero", + "SelectAllLibraries", "RegenerateEdlFiles", "UseChromaprint", "CacheFingerprints", @@ -767,6 +772,8 @@ var windowHashInterval = 0; var autoSkip = document.querySelector("input#AutoSkip"); + var selectAllLibraries = document.querySelector("input#SelectAllLibraries"); + var librariesContainer = document.querySelector("div.folderAccessListContainer"); var skipFirstEpisode = document.querySelector("div#divSkipFirstEpisode"); var secondsOfIntroStartToPlay = document.querySelector("div#divSecondsOfIntroStartToPlay"); var autoSkipClientList = document.getElementById("AutoSkipClientList"); @@ -812,6 +819,16 @@ } } + function selectAllLibrariesChanged() { + if (selectAllLibraries.checked) { + librariesContainer.style.display = 'none'; + } else { + librariesContainer.style.display = 'unset'; + } + } + + selectAllLibraries.addEventListener("change", selectAllLibrariesChanged); + function updateList(textField, container) { textField.value = Array.from(container.querySelectorAll('input[type="checkbox"]:checked')) .map(checkbox => checkbox.nextElementSibling.textContent) @@ -1202,6 +1219,7 @@ } populateLibraries(); + selectAllLibrariesChanged(); autoSkipChanged(); autoSkipCreditsChanged(); persistSkipChanged(); diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/QueueManager.cs b/ConfusedPolarBear.Plugin.IntroSkipper/QueueManager.cs index 96b6d5b..5947fc4 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/QueueManager.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/QueueManager.cs @@ -27,6 +27,7 @@ public class QueueManager(ILogger logger, ILibraryManager libraryM private readonly Dictionary> _queuedEpisodes = []; private double _analysisPercent; private List _selectedLibraries = []; + private bool _selectAllLibraries; /// /// Gets all media items on the server. @@ -42,7 +43,7 @@ public class QueueManager(ILogger logger, ILibraryManager libraryM foreach (var folder in _libraryManager.GetVirtualFolders()) { // If libraries have been selected for analysis, ensure this library was selected. - if (_selectedLibraries.Count > 0 && !_selectedLibraries.Contains(folder.Name)) + if (!_selectAllLibraries && !_selectedLibraries.Contains(folder.Name)) { _logger.LogDebug("Not analyzing library \"{Name}\": not selected by user", folder.Name); continue; @@ -92,12 +93,14 @@ public class QueueManager(ILogger logger, ILibraryManager libraryM // Store the analysis percent _analysisPercent = Convert.ToDouble(config.AnalysisPercent) / 100; - // Get the list of library names which have been selected for analysis, ignoring whitespace and empty entries. - _selectedLibraries = [.. config.SelectedLibraries.Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries)]; + _selectAllLibraries = config.SelectAllLibraries; - // If any libraries have been selected for analysis, log their names. - if (_selectedLibraries.Count > 0) + if (!_selectAllLibraries) { + // Get the list of library names which have been selected for analysis, ignoring whitespace and empty entries. + _selectedLibraries = [.. config.SelectedLibraries.Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries)]; + + // If any libraries have been selected for analysis, log their names. _logger.LogInformation("Limiting analysis to the following libraries: {Selected}", _selectedLibraries); } else diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/BaseItemAnalyzerTask.cs b/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/BaseItemAnalyzerTask.cs index 1e17936..266ef33 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/BaseItemAnalyzerTask.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/BaseItemAnalyzerTask.cs @@ -91,7 +91,7 @@ public class BaseItemAnalyzerTask if (totalQueued == 0) { throw new FingerprintException( - "No episodes to analyze. If you are limiting the list of libraries to analyze, check that all library names have been spelled correctly."); + "No libraries selected for analysis. Please visit the plugin settings to configure."); } if (Plugin.Instance!.Configuration.EdlAction != EdlAction.None)