Reorganize plugin constructor

This commit is contained in:
ConfusedPolarBear 2022-09-27 21:03:27 -05:00
parent c41e134a10
commit 90ca76210f

View File

@ -40,28 +40,25 @@ public class Plugin : BasePlugin<PluginConfiguration>, IHasWebPages
ILogger<Plugin> logger) ILogger<Plugin> logger)
: base(applicationPaths, xmlSerializer) : base(applicationPaths, xmlSerializer)
{ {
Instance = this;
_xmlSerializer = xmlSerializer; _xmlSerializer = xmlSerializer;
_libraryManager = libraryManager; _libraryManager = libraryManager;
_logger = logger; _logger = logger;
// Create the base & cache directories (if needed).
FingerprintCachePath = Path.Join(applicationPaths.PluginConfigurationsPath, "intros", "cache"); 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)) if (!Directory.Exists(FingerprintCachePath))
{ {
Directory.CreateDirectory(FingerprintCachePath); Directory.CreateDirectory(FingerprintCachePath);
} }
_introPath = Path.Join(applicationPaths.PluginConfigurationsPath, "intros", "intros.xml");
// Get the path to FFmpeg.
FFmpegPath = serverConfiguration.GetEncodingOptions().EncoderAppPathDisplay;
Intros = new Dictionary<Guid, Intro>();
AnalysisQueue = new Dictionary<Guid, List<QueuedEpisode>>();
Instance = this;
ConfigurationChanged += OnConfigurationChanged; ConfigurationChanged += OnConfigurationChanged;
// TODO: remove when https://github.com/jellyfin/jellyfin-meta/discussions/30 is complete
try try
{ {
RestoreTimestamps(); RestoreTimestamps();
@ -80,12 +77,12 @@ public class Plugin : BasePlugin<PluginConfiguration>, IHasWebPages
/// <summary> /// <summary>
/// Gets the results of fingerprinting all episodes. /// Gets the results of fingerprinting all episodes.
/// </summary> /// </summary>
public Dictionary<Guid, Intro> Intros { get; } public Dictionary<Guid, Intro> Intros { get; } = new();
/// <summary> /// <summary>
/// Gets the mapping of season ids to episodes that have been queued for fingerprinting. /// Gets the mapping of season ids to episodes that have been queued for fingerprinting.
/// </summary> /// </summary>
public Dictionary<Guid, List<QueuedEpisode>> AnalysisQueue { get; } public Dictionary<Guid, List<QueuedEpisode>> AnalysisQueue { get; } = new();
/// <summary> /// <summary>
/// Gets or sets the total number of episodes in the queue. /// Gets or sets the total number of episodes in the queue.