From 49429b9ca46a20bdacbe77abe672b6e3c52f09b1 Mon Sep 17 00:00:00 2001 From: rlauuzo <46294892+rlauuzo@users.noreply.github.com> Date: Thu, 10 Oct 2024 15:49:18 +0200 Subject: [PATCH] No restart to enable autoscan (#338) --- .../Services/Entrypoint.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Services/Entrypoint.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Services/Entrypoint.cs index 427867e..5fc196a 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Services/Entrypoint.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Services/Entrypoint.cs @@ -8,6 +8,7 @@ using ConfusedPolarBear.Plugin.IntroSkipper.ScheduledTasks; using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Library; using MediaBrowser.Model.Entities; +using MediaBrowser.Model.Plugins; using MediaBrowser.Model.Tasks; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; @@ -25,8 +26,8 @@ public sealed class Entrypoint : IHostedService, IDisposable private readonly ILoggerFactory _loggerFactory; private readonly HashSet _seasonsToAnalyze = []; private readonly Timer _queueTimer; - private readonly PluginConfiguration _config; private static readonly ManualResetEventSlim _autoTaskCompletEvent = new(false); + private PluginConfiguration _config; private bool _analyzeAgain; private static CancellationTokenSource? _cancellationTokenSource; @@ -80,6 +81,7 @@ public sealed class Entrypoint : IHostedService, IDisposable _libraryManager.ItemAdded += OnItemAdded; _libraryManager.ItemUpdated += OnItemModified; _taskManager.TaskCompleted += OnLibraryRefresh; + Plugin.Instance!.ConfigurationChanged += OnSettingsChanged; FFmpegWrapper.Logger = _logger; @@ -206,6 +208,8 @@ public sealed class Entrypoint : IHostedService, IDisposable StartTimer(); } + private void OnSettingsChanged(object? sender, BasePluginConfiguration e) => _config = (PluginConfiguration)e; + /// /// Start timer to debounce analyzing. ///