From f92c6143488336ab5549ddfd43e4345b800aa18e Mon Sep 17 00:00:00 2001 From: ConfusedPolarBear <33811686+ConfusedPolarBear@users.noreply.github.com> Date: Mon, 22 Aug 2022 23:18:13 -0500 Subject: [PATCH] Fix analyze episodes task interval Fixes #79 --- .../TestAudioFingerprinting.cs | 4 ++-- ...rprinterTask.cs => AnalyzeEpisodesTask.cs} | 19 +++++++++---------- 2 files changed, 11 insertions(+), 12 deletions(-) rename ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/{FingerprinterTask.cs => AnalyzeEpisodesTask.cs} (97%) diff --git a/ConfusedPolarBear.Plugin.IntroSkipper.Tests/TestAudioFingerprinting.cs b/ConfusedPolarBear.Plugin.IntroSkipper.Tests/TestAudioFingerprinting.cs index 91ece56..c6e2570 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper.Tests/TestAudioFingerprinting.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper.Tests/TestAudioFingerprinting.cs @@ -25,7 +25,7 @@ public class TestAudioFingerprinting [InlineData(19, 2_465_585_877)] public void TestBitCounting(int expectedBits, uint number) { - Assert.Equal(expectedBits, FingerprinterTask.CountBits(number)); + Assert.Equal(expectedBits, AnalyzeEpisodesTask.CountBits(number)); } [FactSkipFFmpegTests] @@ -85,7 +85,7 @@ public class TestAudioFingerprinting [FactSkipFFmpegTests] public void TestIntroDetection() { - var task = new FingerprinterTask(new LoggerFactory()); + var task = new AnalyzeEpisodesTask(new LoggerFactory()); var lhsEpisode = queueEpisode("audio/big_buck_bunny_intro.mp3"); var rhsEpisode = queueEpisode("audio/big_buck_bunny_clip.mp3"); diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/FingerprinterTask.cs b/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/AnalyzeEpisodesTask.cs similarity index 97% rename from ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/FingerprinterTask.cs rename to ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/AnalyzeEpisodesTask.cs index cd64efe..17ebc82 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/FingerprinterTask.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/AnalyzeEpisodesTask.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Collections.ObjectModel; using System.Numerics; using System.Threading; using System.Threading.Tasks; @@ -11,9 +10,9 @@ using Microsoft.Extensions.Logging; namespace ConfusedPolarBear.Plugin.IntroSkipper; /// -/// Fingerprint and analyze all queued episodes for common audio sequences. +/// Analyze all television episodes for introduction sequences. /// -public class FingerprinterTask : IScheduledTask +public class AnalyzeEpisodesTask : IScheduledTask { /// /// Maximum number of bits (out of 32 total) that can be different between segments before they are considered dissimilar. @@ -41,7 +40,7 @@ public class FingerprinterTask : IScheduledTask /// private const double ReanalysisTolerance = ReanalysisBucketWidth * 1.5; - private readonly ILogger _logger; + private readonly ILogger _logger; private readonly ILogger _queueLogger; @@ -74,22 +73,22 @@ public class FingerprinterTask : IScheduledTask private static int minimumIntroDuration = 15; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// Logger factory. /// Library manager. - public FingerprinterTask(ILoggerFactory loggerFactory, ILibraryManager libraryManager) : this(loggerFactory) + public AnalyzeEpisodesTask(ILoggerFactory loggerFactory, ILibraryManager libraryManager) : this(loggerFactory) { _libraryManager = libraryManager; } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// Logger factory. - public FingerprinterTask(ILoggerFactory loggerFactory) + public AnalyzeEpisodesTask(ILoggerFactory loggerFactory) { - _logger = loggerFactory.CreateLogger(); + _logger = loggerFactory.CreateLogger(); _queueLogger = loggerFactory.CreateLogger(); _fingerprintCache = new Dictionary(); @@ -894,7 +893,7 @@ public class FingerprinterTask : IScheduledTask new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerDaily, - TimeOfDayTicks = TimeSpan.FromDays(24).Ticks + TimeOfDayTicks = TimeSpan.FromHours(0).Ticks } }; }