diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Data/Intro.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Data/Intro.cs
index 714cfba..f5adad9 100644
--- a/ConfusedPolarBear.Plugin.IntroSkipper/Data/Intro.cs
+++ b/ConfusedPolarBear.Plugin.IntroSkipper/Data/Intro.cs
@@ -12,13 +12,23 @@ public class Intro
/// Initializes a new instance of the class.
///
/// Episode.
- /// Intro start time.
- /// Intro end time.
- public Intro(Guid episode, double start, double end)
+ /// Introduction time range.
+ public Intro(Guid episode, TimeRange intro)
{
EpisodeId = episode;
- IntroStart = start;
- IntroEnd = end;
+ IntroStart = intro.Start;
+ IntroEnd = intro.End;
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Episode.
+ public Intro(Guid episode)
+ {
+ EpisodeId = episode;
+ IntroStart = 0;
+ IntroEnd = 0;
}
///
diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/FingerprinterTask.cs b/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/FingerprinterTask.cs
index 9b60a03..d4a4def 100644
--- a/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/FingerprinterTask.cs
+++ b/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/FingerprinterTask.cs
@@ -232,49 +232,49 @@ public class FingerprinterTask : IScheduledTask
/// Analyze two episodes to find an introduction sequence shared between them.
///
/// First episode id.
- /// First episode to analyze.
+ /// First episode fingerprint points.
/// Second episode id.
- /// Second episode to analyze.
+ /// Second episode fingerprint points.
/// Intros for the first and second episodes.
public (Intro Lhs, Intro Rhs) FingerprintEpisodes(
Guid lhsId,
- ReadOnlyCollection lhs,
+ ReadOnlyCollection lhsPoints,
Guid rhsId,
- ReadOnlyCollection rhs)
+ ReadOnlyCollection rhsPoints)
{
var lhsRanges = new List();
var rhsRanges = new List();
// Compare all elements of the shortest fingerprint to the other fingerprint.
- var limit = Math.Min(lhs.Count, rhs.Count);
+ var limit = Math.Min(lhsPoints.Count, rhsPoints.Count);
// First, test if an intro can be found within the first 5 seconds of the episodes (±5/0.128 = ±40 samples).
- var (lhsContiguous, rhsContiguous) = ShiftEpisodes(lhs, rhs, -40, 40);
+ var (lhsContiguous, rhsContiguous) = ShiftEpisodes(lhsPoints, rhsPoints, -40, 40);
lhsRanges.AddRange(lhsContiguous);
rhsRanges.AddRange(rhsContiguous);
// If no valid ranges were found, re-analyze the episodes considering all possible shifts.
if (lhsRanges.Count == 0)
{
- _logger.LogDebug("using full scan");
+ _logger.LogDebug("quick scan unsuccessful, falling back to full scan");
- (lhsContiguous, rhsContiguous) = ShiftEpisodes(lhs, rhs, -1 * limit, limit);
+ (lhsContiguous, rhsContiguous) = ShiftEpisodes(lhsPoints, rhsPoints, -1 * limit, limit);
lhsRanges.AddRange(lhsContiguous);
rhsRanges.AddRange(rhsContiguous);
}
else
{
- _logger.LogDebug("intro found with quick scan");
+ _logger.LogDebug("quick scan successful");
}
if (lhsRanges.Count == 0)
{
_logger.LogDebug(
- "Unable to find a shared introduction sequence {LHS} and {RHS}",
+ "Unable to find a shared introduction sequence between {LHS} and {RHS}",
lhsId,
rhsId);
- return (new Intro(lhsId, 0, 0), new Intro(rhsId, 0, 0));
+ return (new Intro(lhsId), new Intro(rhsId));
}
// After comparing both episodes at all possible shift positions, store the longest time range as the intro.
@@ -295,11 +295,11 @@ public class FingerprinterTask : IScheduledTask
rhsIntro.Start = 0;
}
- return (new Intro(lhsId, lhsIntro.Start, lhsIntro.End), new Intro(rhsId, rhsIntro.Start, rhsIntro.End));
+ return (new Intro(lhsId, lhsIntro), new Intro(rhsId, rhsIntro));
}
///
- /// Shifts episodes through the range of provided shift amounts and returns discovered contiguous time ranges.
+ /// Shifts a pair of episodes through the range of provided shift amounts and returns discovered contiguous time ranges.
///
/// First episode fingerprint.
/// Second episode fingerprint.