From fb6cd5c1d7a11295a2bb822f0f02d6d9331154ce Mon Sep 17 00:00:00 2001 From: ConfusedPolarBear <33811686+ConfusedPolarBear@users.noreply.github.com> Date: Sun, 28 Aug 2022 22:35:43 -0500 Subject: [PATCH] Rename {Chromaprint,FFmpegWrapper}.cs --- .../TestAudioFingerprinting.cs | 10 +++++----- .../Controllers/TroubleshootingController.cs | 2 +- .../Controllers/VisualizationController.cs | 2 +- ConfusedPolarBear.Plugin.IntroSkipper/Entrypoint.cs | 2 +- .../{Chromaprint.cs => FFmpegWrapper.cs} | 4 ++-- ConfusedPolarBear.Plugin.IntroSkipper/QueueManager.cs | 2 +- .../ScheduledTasks/AnalyzeEpisodesTask.cs | 6 +++--- 7 files changed, 14 insertions(+), 14 deletions(-) rename ConfusedPolarBear.Plugin.IntroSkipper/{Chromaprint.cs => FFmpegWrapper.cs} (99%) diff --git a/ConfusedPolarBear.Plugin.IntroSkipper.Tests/TestAudioFingerprinting.cs b/ConfusedPolarBear.Plugin.IntroSkipper.Tests/TestAudioFingerprinting.cs index 140ebd7..a940067 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper.Tests/TestAudioFingerprinting.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper.Tests/TestAudioFingerprinting.cs @@ -14,7 +14,7 @@ public class TestAudioFingerprinting [FactSkipFFmpegTests] public void TestInstallationCheck() { - Assert.True(Chromaprint.CheckFFmpegVersion()); + Assert.True(FFmpegWrapper.CheckFFmpegVersion()); } [Theory] @@ -58,7 +58,7 @@ public class TestAudioFingerprinting 3472417825, 3395841056, 3458735136, 3341420624, 1076496560, 1076501168, 1076501136, 1076497024 }; - var actual = Chromaprint.Fingerprint(queueEpisode("audio/big_buck_bunny_intro.mp3")); + var actual = FFmpegWrapper.Fingerprint(queueEpisode("audio/big_buck_bunny_intro.mp3")); Assert.Equal(expected, actual); } @@ -78,7 +78,7 @@ public class TestAudioFingerprinting {77, 5}, }; - var actual = Chromaprint.CreateInvertedIndex(Guid.NewGuid(), fpr); + var actual = FFmpegWrapper.CreateInvertedIndex(Guid.NewGuid(), fpr); Assert.Equal(expected, actual); } @@ -90,8 +90,8 @@ public class TestAudioFingerprinting var lhsEpisode = queueEpisode("audio/big_buck_bunny_intro.mp3"); var rhsEpisode = queueEpisode("audio/big_buck_bunny_clip.mp3"); - var lhsFingerprint = Chromaprint.Fingerprint(lhsEpisode); - var rhsFingerprint = Chromaprint.Fingerprint(rhsEpisode); + var lhsFingerprint = FFmpegWrapper.Fingerprint(lhsEpisode); + var rhsFingerprint = FFmpegWrapper.Fingerprint(rhsEpisode); var (lhs, rhs) = task.CompareEpisodes( lhsEpisode.EpisodeId, diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Controllers/TroubleshootingController.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Controllers/TroubleshootingController.cs index 3554feb..8923daf 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Controllers/TroubleshootingController.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Controllers/TroubleshootingController.cs @@ -58,7 +58,7 @@ public class TroubleshootingController : ControllerBase bundle.Append(" seasons"); bundle.Append('\n'); - bundle.Append(Chromaprint.GetChromaprintLogs()); + bundle.Append(FFmpegWrapper.GetChromaprintLogs()); return bundle.ToString(); } diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Controllers/VisualizationController.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Controllers/VisualizationController.cs index 6d4d042..5cf7bc1 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Controllers/VisualizationController.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Controllers/VisualizationController.cs @@ -113,7 +113,7 @@ public class VisualizationController : ControllerBase { if (needle.EpisodeId == id) { - return Chromaprint.Fingerprint(needle); + return FFmpegWrapper.Fingerprint(needle); } } } diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Entrypoint.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Entrypoint.cs index 5113ef4..6a5dff2 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Entrypoint.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Entrypoint.cs @@ -46,7 +46,7 @@ public class Entrypoint : IServerEntryPoint /// Task. public Task RunAsync() { - Chromaprint.Logger = _logger; + FFmpegWrapper.Logger = _logger; #if DEBUG LogVersion(); diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Chromaprint.cs b/ConfusedPolarBear.Plugin.IntroSkipper/FFmpegWrapper.cs similarity index 99% rename from ConfusedPolarBear.Plugin.IntroSkipper/Chromaprint.cs rename to ConfusedPolarBear.Plugin.IntroSkipper/FFmpegWrapper.cs index ffe3602..bda56ef 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Chromaprint.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/FFmpegWrapper.cs @@ -9,9 +9,9 @@ using Microsoft.Extensions.Logging; namespace ConfusedPolarBear.Plugin.IntroSkipper; /// -/// Wrapper for libchromaprint. +/// Wrapper for libchromaprint and the silencedetect filter. /// -public static class Chromaprint +public static class FFmpegWrapper { /// /// Gets or sets the logger. diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/QueueManager.cs b/ConfusedPolarBear.Plugin.IntroSkipper/QueueManager.cs index 6f07285..185cc60 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/QueueManager.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/QueueManager.cs @@ -40,7 +40,7 @@ public class QueueManager public void EnqueueAllEpisodes() { // Assert that ffmpeg with chromaprint is installed - if (!Chromaprint.CheckFFmpegVersion()) + if (!FFmpegWrapper.CheckFFmpegVersion()) { throw new FingerprintException( "ffmpeg with chromaprint is not installed on this system - episodes will not be analyzed. If Jellyfin is running natively, install jellyfin-ffmpeg5. If Jellyfin is running in a container, upgrade it to the latest version of 10.8.0."); diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/AnalyzeEpisodesTask.cs b/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/AnalyzeEpisodesTask.cs index f8d71be..42acf8e 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/AnalyzeEpisodesTask.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/AnalyzeEpisodesTask.cs @@ -269,7 +269,7 @@ public class AnalyzeEpisodesTask : IScheduledTask { try { - fingerprintCache[episode.EpisodeId] = Chromaprint.Fingerprint(episode); + fingerprintCache[episode.EpisodeId] = FFmpegWrapper.Fingerprint(episode); } catch (FingerprintException ex) { @@ -436,8 +436,8 @@ public class AnalyzeEpisodesTask : IScheduledTask var rhsRanges = new List(); // Generate inverted indexes for the left and right episodes. - var lhsIndex = Chromaprint.CreateInvertedIndex(lhsId, lhsPoints); - var rhsIndex = Chromaprint.CreateInvertedIndex(rhsId, rhsPoints); + var lhsIndex = FFmpegWrapper.CreateInvertedIndex(lhsId, lhsPoints); + var rhsIndex = FFmpegWrapper.CreateInvertedIndex(rhsId, rhsPoints); var indexShifts = new HashSet(); // For all audio points in the left episode, check if the right episode has a point which matches exactly.