+ Interactively compare the audio fingerprints of two episodes.
+ The blue and red bar to the right of the fingerprint diff turns blue
+ when the corresponding fingerprint points are at least 75% similar.
+
+
+
+
Key
+
Function
+
+
+
+
Up arrow
+
+ Shift the left episode up by 0.128 seconds.
+ Holding control will shift the episode by 10 seconds.
+
+
+
+
Down arrow
+
+ Shift the left episode down by 0.128 seconds.
+ Holding control will shift the episode by 10 seconds.
+
+
+
+
Right arrow
+
Advance to the next pair of episodes.
+
+
+
Left arrow
+
Go back to the previous pair of episodes.
+
+
+
+
@@ -61,21 +97,23 @@
+ Shift amount:
-
+
diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Controllers/TroubleshooterController.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Controllers/TroubleshooterController.cs
index 492691e..fb65bcd 100644
--- a/ConfusedPolarBear.Plugin.IntroSkipper/Controllers/TroubleshooterController.cs
+++ b/ConfusedPolarBear.Plugin.IntroSkipper/Controllers/TroubleshooterController.cs
@@ -11,7 +11,7 @@ namespace ConfusedPolarBear.Plugin.IntroSkipper.Controllers;
///
/// Intro skipper troubleshooting controller. Allows browsing fingerprints on a per episode basis.
///
-[Authorize]
+[Authorize(Policy = "RequiresElevation")]
[ApiController]
[Produces(MediaTypeNames.Application.Json)]
[Route("Intros")]
diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Data/TimeRange.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Data/TimeRange.cs
index 10f3ae1..fb9ef1d 100644
--- a/ConfusedPolarBear.Plugin.IntroSkipper/Data/TimeRange.cs
+++ b/ConfusedPolarBear.Plugin.IntroSkipper/Data/TimeRange.cs
@@ -3,6 +3,9 @@ using System.Collections.Generic;
namespace ConfusedPolarBear.Plugin.IntroSkipper;
+// Supress CA1036: Override methods on comparable types.
+#pragma warning disable CA1036
+
///
/// Range of contiguous time.
///
@@ -54,98 +57,23 @@ public class TimeRange : IComparable
public double Duration => End - Start;
///
- /// Comparison operator.
+ /// Compare TimeRange durations.
///
- /// Left TimeRange.
- /// Right TimeRange.
- public static bool operator ==(TimeRange left, TimeRange right)
- {
- return left.Equals(right);
- }
-
- ///
- /// Comparison operator.
- ///
- /// Left TimeRange.
- /// Right TimeRange.
- public static bool operator !=(TimeRange left, TimeRange right)
- {
- return !left.Equals(right);
- }
-
- ///
- /// Comparison operator.
- ///
- /// Left TimeRange.
- /// Right TimeRange.
- public static bool operator <=(TimeRange left, TimeRange right)
- {
- return left.CompareTo(right) <= 0;
- }
-
- ///
- /// Comparison operator.
- ///
- /// Left TimeRange.
- /// Right TimeRange.
- public static bool operator <(TimeRange left, TimeRange right)
- {
- return left.CompareTo(right) < 0;
- }
-
- ///
- /// Comparison operator.
- ///
- /// Left TimeRange.
- /// Right TimeRange.
- public static bool operator >=(TimeRange left, TimeRange right)
- {
- return left.CompareTo(right) >= 0;
- }
-
- ///
- /// Comparison operator.
- ///
- /// Left TimeRange.
- /// Right TimeRange.
- public static bool operator >(TimeRange left, TimeRange right)
- {
- return left.CompareTo(right) > 0;
- }
-
- ///
- /// Compares this TimeRange to another TimeRange.
- ///
- /// Other object to compare against.
- /// A signed integer that indicates whether this instance precedes, follows, or appears in the same position in the sort order as the obj parameter.
+ /// Object to compare with.
+ /// int.
public int CompareTo(object? obj)
{
- if (obj is not TimeRange tr)
+ if (!(obj is TimeRange tr))
{
- return 0;
+ throw new ArgumentException("obj must be a TimeRange");
}
- return this.Duration.CompareTo(tr.Duration);
- }
-
- ///
- public override bool Equals(object? obj)
- {
- if (obj is null || obj is not TimeRange tr)
- {
- return false;
- }
-
- return this.Start == tr.Start && this.Duration == tr.Duration;
- }
-
- ///
- public override int GetHashCode()
- {
- return this.Start.GetHashCode() + this.Duration.GetHashCode();
+ return tr.Duration.CompareTo(Duration);
}
}
+#pragma warning restore CA1036
+
///
/// Time range helpers.
///
@@ -167,7 +95,7 @@ public static class TimeRangeHelpers
Array.Sort(times);
var ranges = new List();
- var currentRange = new TimeRange(times[0], 0);
+ var currentRange = new TimeRange(times[0], times[0]);
// For all provided timestamps, check if it is contiguous with its neighbor.
for (var i = 0; i < times.Length - 1; i++)
@@ -182,7 +110,7 @@ public static class TimeRangeHelpers
}
ranges.Add(new TimeRange(currentRange));
- currentRange.Start = next;
+ currentRange = new TimeRange(next, next);
}
// Find and return the longest contiguous range.
diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/FingerprinterTask.cs b/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/FingerprinterTask.cs
index 9d6cc2c..43072c9 100644
--- a/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/FingerprinterTask.cs
+++ b/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/FingerprinterTask.cs
@@ -21,13 +21,14 @@ public class FingerprinterTask : IScheduledTask
///
/// Maximum number of bits (out of 32 total) that can be different between segments before they are considered dissimilar.
+ /// 8 bits means the audio must be at least 75% similar (1 - 8 / 32).
///
- private const double MaximumDifferences = 3;
+ private const double MaximumDifferences = 8;
///
/// Maximum time (in seconds) permitted between timestamps before they are considered non-contiguous.
///
- private const double MaximumDistance = 3.25;
+ private const double MaximumDistance = 2.5;
///
/// Seconds of audio in one fingerprint point. This value is defined by the Chromaprint library and should not be changed.
@@ -192,7 +193,7 @@ public class FingerprinterTask : IScheduledTask
var rhs = episodes[i + 1];
// TODO: make configurable
- if (!everFoundIntro && failures >= 6)
+ if (!everFoundIntro && failures >= 20)
{
_logger.LogWarning(
"Failed to find an introduction in {Series} season {Season}",
@@ -312,7 +313,7 @@ public class FingerprinterTask : IScheduledTask
// If no valid ranges were found, re-analyze the episodes considering all possible shifts.
if (lhsRanges.Count == 0)
{
- _logger.LogDebug("quick scan unsuccessful, falling back to full scan");
+ _logger.LogDebug("quick scan unsuccessful, falling back to full scan (±{Limit})", limit);
(lhsContiguous, rhsContiguous) = ShiftEpisodes(lhsPoints, rhsPoints, -1 * limit, limit);
lhsRanges.AddRange(lhsContiguous);