No restart to enable autoscan (#338)

This commit is contained in:
rlauuzo 2024-10-10 15:49:18 +02:00 committed by GitHub
parent 76c9d8013f
commit 49429b9ca4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -8,6 +8,7 @@ using ConfusedPolarBear.Plugin.IntroSkipper.ScheduledTasks;
using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Entities; using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Plugins;
using MediaBrowser.Model.Tasks; using MediaBrowser.Model.Tasks;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
@ -25,8 +26,8 @@ public sealed class Entrypoint : IHostedService, IDisposable
private readonly ILoggerFactory _loggerFactory; private readonly ILoggerFactory _loggerFactory;
private readonly HashSet<Guid> _seasonsToAnalyze = []; private readonly HashSet<Guid> _seasonsToAnalyze = [];
private readonly Timer _queueTimer; private readonly Timer _queueTimer;
private readonly PluginConfiguration _config;
private static readonly ManualResetEventSlim _autoTaskCompletEvent = new(false); private static readonly ManualResetEventSlim _autoTaskCompletEvent = new(false);
private PluginConfiguration _config;
private bool _analyzeAgain; private bool _analyzeAgain;
private static CancellationTokenSource? _cancellationTokenSource; private static CancellationTokenSource? _cancellationTokenSource;
@ -80,6 +81,7 @@ public sealed class Entrypoint : IHostedService, IDisposable
_libraryManager.ItemAdded += OnItemAdded; _libraryManager.ItemAdded += OnItemAdded;
_libraryManager.ItemUpdated += OnItemModified; _libraryManager.ItemUpdated += OnItemModified;
_taskManager.TaskCompleted += OnLibraryRefresh; _taskManager.TaskCompleted += OnLibraryRefresh;
Plugin.Instance!.ConfigurationChanged += OnSettingsChanged;
FFmpegWrapper.Logger = _logger; FFmpegWrapper.Logger = _logger;
@ -206,6 +208,8 @@ public sealed class Entrypoint : IHostedService, IDisposable
StartTimer(); StartTimer();
} }
private void OnSettingsChanged(object? sender, BasePluginConfiguration e) => _config = (PluginConfiguration)e;
/// <summary> /// <summary>
/// Start timer to debounce analyzing. /// Start timer to debounce analyzing.
/// </summary> /// </summary>