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;
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;
/// <summary>

View File

@ -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;

View File

@ -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
/// </summary>
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)
{

View File

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