code cleanup

This commit is contained in:
Kilian von Pflugk 2024-04-20 12:29:40 +02:00
parent 169e08047c
commit 451fc8a511
4 changed files with 14 additions and 21 deletions

View File

@ -1,12 +1,7 @@
namespace ConfusedPolarBear.Plugin.IntroSkipper; namespace ConfusedPolarBear.Plugin.IntroSkipper;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Globalization;
using System.Linq;
using System.Threading; using System.Threading;
using MediaBrowser.Model.Entities;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
/// <summary> /// <summary>

View File

@ -90,15 +90,15 @@ public class SkipIntroController : ControllerBase
segment.IntroEnd -= config.SecondsOfIntroToPlay; segment.IntroEnd -= config.SecondsOfIntroToPlay;
if (config.PersistSkipButton) if (config.PersistSkipButton)
{ {
segment.ShowSkipPromptAt = segment.IntroStart; segment.ShowSkipPromptAt = segment.IntroStart;
segment.HideSkipPromptAt = segment.IntroEnd; segment.HideSkipPromptAt = segment.IntroEnd;
} }
else else
{ {
segment.ShowSkipPromptAt = Math.Max(0, segment.IntroStart - config.ShowPromptAdjustment); segment.ShowSkipPromptAt = Math.Max(0, segment.IntroStart - config.ShowPromptAdjustment);
segment.HideSkipPromptAt = Math.Min( segment.HideSkipPromptAt = Math.Min(
segment.IntroStart + config.HidePromptAdjustment, segment.IntroStart + config.HidePromptAdjustment,
segment.IntroEnd); segment.IntroEnd);
} }
return segment; return segment;

View File

@ -1,10 +1,8 @@
using System; using System;
using System.IO;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Plugins;
using MediaBrowser.Model.Entities; using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Tasks; using MediaBrowser.Model.Tasks;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
@ -112,10 +110,10 @@ public class Entrypoint : IHostedService, IDisposable
_queueTimer.Change(Timeout.Infinite, 0); _queueTimer.Change(Timeout.Infinite, 0);
if (_cancellationTokenSource != null) // Null Check if (_cancellationTokenSource != null) // Null Check
{ {
_cancellationTokenSource.Dispose(); _cancellationTokenSource.Dispose();
_cancellationTokenSource = null; _cancellationTokenSource = null;
} }
return Task.CompletedTask; return Task.CompletedTask;
} }
@ -208,7 +206,7 @@ public class Entrypoint : IHostedService, IDisposable
} }
// Unless user initiated, this is likely an overlap // Unless user initiated, this is likely an overlap
if (AutomaticTaskState == TaskState.Running) if (Entrypoint.AutomaticTaskState == TaskState.Running)
{ {
return; return;
} }
@ -221,9 +219,9 @@ public class Entrypoint : IHostedService, IDisposable
/// </summary> /// </summary>
private void StartTimer() 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) else if (ScheduledTaskSemaphore.CurrentCount > 0)
{ {

View File

@ -136,7 +136,7 @@ public static class FFmpegWrapper
/// </summary> /// </summary>
/// <param name="id">Episode ID.</param> /// <param name="id">Episode ID.</param>
/// <param name="fingerprint">Chromaprint fingerprint.</param> /// <param name="fingerprint">Chromaprint fingerprint.</param>
/// <param name="mode">Mode.</param> /// <param name="mode">Mode.</param>
/// <returns>Inverted index.</returns> /// <returns>Inverted index.</returns>
public static Dictionary<uint, int> CreateInvertedIndex(Guid id, uint[] fingerprint, AnalysisMode mode) public static Dictionary<uint, int> CreateInvertedIndex(Guid id, uint[] fingerprint, AnalysisMode mode)
{ {