diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Analyzers/ChapterAnalyzer.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Analyzers/ChapterAnalyzer.cs index 763d461..1474d74 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Analyzers/ChapterAnalyzer.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Analyzers/ChapterAnalyzer.cs @@ -149,12 +149,21 @@ public class ChapterAnalyzer : IMediaFileAnalyzer continue; } + // Check for possibility of overlapping keywords + var overlap = Regex.IsMatch( + next.Name, + expression, + RegexOptions.None, + TimeSpan.FromSeconds(1)); + + if (overlap) + { + continue; + } + matchingChapter = new(episode.EpisodeId, currentRange); _logger.LogTrace("{Base}: okay", baseMessage); - if (i > 0) - { - break; - } + break; } return matchingChapter; diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Analyzers/ChromaprintAnalyzer.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Analyzers/ChromaprintAnalyzer.cs index 2a03321..c2eb513 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Analyzers/ChromaprintAnalyzer.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Analyzers/ChromaprintAnalyzer.cs @@ -275,10 +275,10 @@ public class ChromaprintAnalyzer : IMediaFileAnalyzer { var modifiedPoint = (uint)(originalPoint + i); - if (rhsIndex.TryGetValue(modifiedPoint, out var value)) + if (rhsIndex.TryGetValue(modifiedPoint, out var rhsModifiedPoint)) { var lhsFirst = (int)lhsIndex[originalPoint]; - var rhsFirst = (int)value; + var rhsFirst = (int)rhsModifiedPoint; indexShifts.Add(rhsFirst - lhsFirst); } } diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Analyzers/SegmentAnalyzer.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Analyzers/SegmentAnalyzer.cs new file mode 100644 index 0000000..da17352 --- /dev/null +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Analyzers/SegmentAnalyzer.cs @@ -0,0 +1,36 @@ +namespace ConfusedPolarBear.Plugin.IntroSkipper; + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Globalization; +using System.Linq; +using System.Threading; +using MediaBrowser.Model.Entities; +using Microsoft.Extensions.Logging; + +/// +/// Chapter name analyzer. +/// +public class SegmentAnalyzer : IMediaFileAnalyzer +{ + private ILogger _logger; + + /// + /// Initializes a new instance of the class. + /// + /// Logger. + public SegmentAnalyzer(ILogger logger) + { + _logger = logger; + } + + /// + public ReadOnlyCollection AnalyzeMediaFiles( + ReadOnlyCollection analysisQueue, + AnalysisMode mode, + CancellationToken cancellationToken) + { + return analysisQueue; + } +} diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/PluginConfiguration.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/PluginConfiguration.cs index 0d4407e..76e5896 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/PluginConfiguration.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/PluginConfiguration.cs @@ -17,11 +17,6 @@ public class PluginConfiguration : BasePluginConfiguration // ===== Analysis settings ===== - /// - /// Gets or sets a value indicating whether the episode's fingerprint should be cached to the filesystem. - /// - public bool CacheFingerprints { get; set; } = true; - /// /// Gets or sets the max degree of parallelism used when analyzing episodes. /// @@ -37,6 +32,16 @@ public class PluginConfiguration : BasePluginConfiguration /// public bool AnalyzeSeasonZero { get; set; } = false; + /// + /// Gets or sets a value indicating whether the episode's fingerprint should be cached to the filesystem. + /// + public bool CacheFingerprints { get; set; } = true; + + /// + /// Gets or sets a value indicating whether analysis will use Chromaprint to determine fingerprints. + /// + public bool UseChromaprint { get; set; } = true; + // ===== EDL handling ===== /// diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/configPage.html b/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/configPage.html index c60bdc7..c8622c5 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/configPage.html +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/configPage.html @@ -30,11 +30,14 @@
- Analyze show extras (specials). + If checked, season 0 (specials / extras) will be included in analysis. +
+ Note: Shows containing both a specials and extra folder will identify extras as season 0 + and ignore specials, regardless of this setting.
@@ -44,7 +47,7 @@
- Maximum degree of parallelism to use when analyzing episodes. + Maximum number of simultaneous async episode analysis operations.
@@ -210,6 +213,20 @@ Process Configuration
+
+ + +
+ If checked, analysis will use Chromaprint to compare episode audio and identify intros. +
+ WARNING: Disabling this option may result in incomplete or innaccurate analysis! +
+
+
+