From 90ca76210f931d1ec9f69c5c2902f1921d987ecf Mon Sep 17 00:00:00 2001 From: ConfusedPolarBear <33811686+ConfusedPolarBear@users.noreply.github.com> Date: Tue, 27 Sep 2022 21:03:27 -0500 Subject: [PATCH] Reorganize plugin constructor --- .../Plugin.cs | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Plugin.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Plugin.cs index 97f041a..80522ca 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Plugin.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Plugin.cs @@ -40,28 +40,25 @@ public class Plugin : BasePlugin, IHasWebPages ILogger logger) : base(applicationPaths, xmlSerializer) { + Instance = this; + _xmlSerializer = xmlSerializer; _libraryManager = libraryManager; _logger = logger; - // Create the base & cache directories (if needed). FingerprintCachePath = Path.Join(applicationPaths.PluginConfigurationsPath, "intros", "cache"); + FFmpegPath = serverConfiguration.GetEncodingOptions().EncoderAppPathDisplay; + _introPath = Path.Join(applicationPaths.PluginConfigurationsPath, "intros", "intros.xml"); + + // Create the base & cache directories (if needed). if (!Directory.Exists(FingerprintCachePath)) { Directory.CreateDirectory(FingerprintCachePath); } - _introPath = Path.Join(applicationPaths.PluginConfigurationsPath, "intros", "intros.xml"); - - // Get the path to FFmpeg. - FFmpegPath = serverConfiguration.GetEncodingOptions().EncoderAppPathDisplay; - - Intros = new Dictionary(); - AnalysisQueue = new Dictionary>(); - Instance = this; - ConfigurationChanged += OnConfigurationChanged; + // TODO: remove when https://github.com/jellyfin/jellyfin-meta/discussions/30 is complete try { RestoreTimestamps(); @@ -80,12 +77,12 @@ public class Plugin : BasePlugin, IHasWebPages /// /// Gets the results of fingerprinting all episodes. /// - public Dictionary Intros { get; } + public Dictionary Intros { get; } = new(); /// /// Gets the mapping of season ids to episodes that have been queued for fingerprinting. /// - public Dictionary> AnalysisQueue { get; } + public Dictionary> AnalysisQueue { get; } = new(); /// /// Gets or sets the total number of episodes in the queue.