parent
19ea0caa19
commit
f92c614348
@ -25,7 +25,7 @@ public class TestAudioFingerprinting
|
|||||||
[InlineData(19, 2_465_585_877)]
|
[InlineData(19, 2_465_585_877)]
|
||||||
public void TestBitCounting(int expectedBits, uint number)
|
public void TestBitCounting(int expectedBits, uint number)
|
||||||
{
|
{
|
||||||
Assert.Equal(expectedBits, FingerprinterTask.CountBits(number));
|
Assert.Equal(expectedBits, AnalyzeEpisodesTask.CountBits(number));
|
||||||
}
|
}
|
||||||
|
|
||||||
[FactSkipFFmpegTests]
|
[FactSkipFFmpegTests]
|
||||||
@ -85,7 +85,7 @@ public class TestAudioFingerprinting
|
|||||||
[FactSkipFFmpegTests]
|
[FactSkipFFmpegTests]
|
||||||
public void TestIntroDetection()
|
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 lhsEpisode = queueEpisode("audio/big_buck_bunny_intro.mp3");
|
||||||
var rhsEpisode = queueEpisode("audio/big_buck_bunny_clip.mp3");
|
var rhsEpisode = queueEpisode("audio/big_buck_bunny_clip.mp3");
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -11,9 +10,9 @@ using Microsoft.Extensions.Logging;
|
|||||||
namespace ConfusedPolarBear.Plugin.IntroSkipper;
|
namespace ConfusedPolarBear.Plugin.IntroSkipper;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fingerprint and analyze all queued episodes for common audio sequences.
|
/// Analyze all television episodes for introduction sequences.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class FingerprinterTask : IScheduledTask
|
public class AnalyzeEpisodesTask : IScheduledTask
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Maximum number of bits (out of 32 total) that can be different between segments before they are considered dissimilar.
|
/// 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
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private const double ReanalysisTolerance = ReanalysisBucketWidth * 1.5;
|
private const double ReanalysisTolerance = ReanalysisBucketWidth * 1.5;
|
||||||
|
|
||||||
private readonly ILogger<FingerprinterTask> _logger;
|
private readonly ILogger<AnalyzeEpisodesTask> _logger;
|
||||||
|
|
||||||
private readonly ILogger<QueueManager> _queueLogger;
|
private readonly ILogger<QueueManager> _queueLogger;
|
||||||
|
|
||||||
@ -74,22 +73,22 @@ public class FingerprinterTask : IScheduledTask
|
|||||||
private static int minimumIntroDuration = 15;
|
private static int minimumIntroDuration = 15;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="FingerprinterTask"/> class.
|
/// Initializes a new instance of the <see cref="AnalyzeEpisodesTask"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="loggerFactory">Logger factory.</param>
|
/// <param name="loggerFactory">Logger factory.</param>
|
||||||
/// <param name="libraryManager">Library manager.</param>
|
/// <param name="libraryManager">Library manager.</param>
|
||||||
public FingerprinterTask(ILoggerFactory loggerFactory, ILibraryManager libraryManager) : this(loggerFactory)
|
public AnalyzeEpisodesTask(ILoggerFactory loggerFactory, ILibraryManager libraryManager) : this(loggerFactory)
|
||||||
{
|
{
|
||||||
_libraryManager = libraryManager;
|
_libraryManager = libraryManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="FingerprinterTask"/> class.
|
/// Initializes a new instance of the <see cref="AnalyzeEpisodesTask"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="loggerFactory">Logger factory.</param>
|
/// <param name="loggerFactory">Logger factory.</param>
|
||||||
public FingerprinterTask(ILoggerFactory loggerFactory)
|
public AnalyzeEpisodesTask(ILoggerFactory loggerFactory)
|
||||||
{
|
{
|
||||||
_logger = loggerFactory.CreateLogger<FingerprinterTask>();
|
_logger = loggerFactory.CreateLogger<AnalyzeEpisodesTask>();
|
||||||
_queueLogger = loggerFactory.CreateLogger<QueueManager>();
|
_queueLogger = loggerFactory.CreateLogger<QueueManager>();
|
||||||
|
|
||||||
_fingerprintCache = new Dictionary<Guid, uint[]>();
|
_fingerprintCache = new Dictionary<Guid, uint[]>();
|
||||||
@ -894,7 +893,7 @@ public class FingerprinterTask : IScheduledTask
|
|||||||
new TaskTriggerInfo
|
new TaskTriggerInfo
|
||||||
{
|
{
|
||||||
Type = TaskTriggerInfo.TriggerDaily,
|
Type = TaskTriggerInfo.TriggerDaily,
|
||||||
TimeOfDayTicks = TimeSpan.FromDays(24).Ticks
|
TimeOfDayTicks = TimeSpan.FromHours(0).Ticks
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user