From 451fc8a5119750f2b29f8975b44a54ece1ebee9c Mon Sep 17 00:00:00 2001 From: Kilian von Pflugk Date: Sat, 20 Apr 2024 12:29:40 +0200 Subject: [PATCH] code cleanup --- .../Analyzers/SegmentAnalyzer.cs | 5 ----- .../Controllers/SkipIntroController.cs | 12 ++++++------ .../Entrypoint.cs | 16 +++++++--------- .../FFmpegWrapper.cs | 2 +- 4 files changed, 14 insertions(+), 21 deletions(-) diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Analyzers/SegmentAnalyzer.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Analyzers/SegmentAnalyzer.cs index da17352..c29ae9d 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Analyzers/SegmentAnalyzer.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Analyzers/SegmentAnalyzer.cs @@ -1,12 +1,7 @@ namespace ConfusedPolarBear.Plugin.IntroSkipper; -using System; -using System.Collections.Generic; using System.Collections.ObjectModel; -using System.Globalization; -using System.Linq; using System.Threading; -using MediaBrowser.Model.Entities; using Microsoft.Extensions.Logging; /// diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Controllers/SkipIntroController.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Controllers/SkipIntroController.cs index 2526011..978d178 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Controllers/SkipIntroController.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Controllers/SkipIntroController.cs @@ -90,15 +90,15 @@ public class SkipIntroController : ControllerBase segment.IntroEnd -= config.SecondsOfIntroToPlay; if (config.PersistSkipButton) { - segment.ShowSkipPromptAt = segment.IntroStart; - segment.HideSkipPromptAt = segment.IntroEnd; + segment.ShowSkipPromptAt = segment.IntroStart; + segment.HideSkipPromptAt = segment.IntroEnd; } else { - segment.ShowSkipPromptAt = Math.Max(0, segment.IntroStart - config.ShowPromptAdjustment); - segment.HideSkipPromptAt = Math.Min( - segment.IntroStart + config.HidePromptAdjustment, - segment.IntroEnd); + segment.ShowSkipPromptAt = Math.Max(0, segment.IntroStart - config.ShowPromptAdjustment); + segment.HideSkipPromptAt = Math.Min( + segment.IntroStart + config.HidePromptAdjustment, + segment.IntroEnd); } return segment; diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Entrypoint.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Entrypoint.cs index 1d6e5be..2508c6d 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Entrypoint.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Entrypoint.cs @@ -1,10 +1,8 @@ using System; -using System.IO; using System.Threading; using System.Threading.Tasks; using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Library; -using MediaBrowser.Controller.Plugins; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Tasks; using Microsoft.Extensions.Hosting; @@ -112,10 +110,10 @@ public class Entrypoint : IHostedService, IDisposable _queueTimer.Change(Timeout.Infinite, 0); if (_cancellationTokenSource != null) // Null Check - { - _cancellationTokenSource.Dispose(); - _cancellationTokenSource = null; - } + { + _cancellationTokenSource.Dispose(); + _cancellationTokenSource = null; + } return Task.CompletedTask; } @@ -208,7 +206,7 @@ public class Entrypoint : IHostedService, IDisposable } // Unless user initiated, this is likely an overlap - if (AutomaticTaskState == TaskState.Running) + if (Entrypoint.AutomaticTaskState == TaskState.Running) { return; } @@ -221,9 +219,9 @@ public class Entrypoint : IHostedService, IDisposable /// private void StartTimer() { - if (AutomaticTaskState == TaskState.Running) + if (Entrypoint.AutomaticTaskState == TaskState.Running) { - _analyzeAgain = true; // Items added during a scan will be included later. + _analyzeAgain = true; // Items added during a scan will be included later. } else if (ScheduledTaskSemaphore.CurrentCount > 0) { diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/FFmpegWrapper.cs b/ConfusedPolarBear.Plugin.IntroSkipper/FFmpegWrapper.cs index 8646afe..81a28c9 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/FFmpegWrapper.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/FFmpegWrapper.cs @@ -136,7 +136,7 @@ public static class FFmpegWrapper /// /// Episode ID. /// Chromaprint fingerprint. - /// Mode. + /// Mode. /// Inverted index. public static Dictionary CreateInvertedIndex(Guid id, uint[] fingerprint, AnalysisMode mode) {