From bee10267380a91a678eada2761518860884ebed1 Mon Sep 17 00:00:00 2001 From: TwistedUmbrellaX <1173913+AbandonedCart@users.noreply.github.com> Date: Thu, 16 May 2024 12:25:06 -0400 Subject: [PATCH] Movin on up (movin on up) (#166) --- .../Plugin.cs | 28 +++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Plugin.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Plugin.cs index 74dd6e4..ba28838 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Plugin.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Plugin.cs @@ -60,15 +60,27 @@ public class Plugin : BasePlugin, IHasWebPages FFmpegPath = serverConfiguration.GetEncodingOptions().EncoderAppPathDisplay; - var introsDirectory = Path.Join(applicationPaths.CachePath, "introskipper"); - FingerprintCachePath = Path.Join(introsDirectory, "chromaprints"); - _introPath = Path.Join(applicationPaths.CachePath, "introskipper", "intros.xml"); - _creditsPath = Path.Join(applicationPaths.CachePath, "introskipper", "credits.xml"); + var pluginDirName = "introskipper"; + var pluginCachePath = "chromaprints"; - var oldintrosDirectory = Path.Join(applicationPaths.PluginConfigurationsPath, "intros"); - _oldFingerprintCachePath = Path.Join(oldintrosDirectory, "cache"); - _oldintroPath = Path.Join(applicationPaths.PluginConfigurationsPath, "intros", "intros.xml"); - _oldcreditsPath = Path.Join(applicationPaths.PluginConfigurationsPath, "intros", "credits.xml"); + var introsDirectory = Path.Join(applicationPaths.DataPath, pluginDirName); + FingerprintCachePath = Path.Join(introsDirectory, pluginCachePath); + _introPath = Path.Join(applicationPaths.DataPath, pluginDirName, "intros.xml"); + _creditsPath = Path.Join(applicationPaths.DataPath, pluginDirName, "credits.xml"); + + var cacheRoot = applicationPaths.CachePath; + var oldintrosDirectory = Path.Join(cacheRoot, pluginDirName); + if (!Directory.Exists(oldintrosDirectory)) + { + pluginDirName = "intros"; + pluginCachePath = "cache"; + cacheRoot = applicationPaths.PluginConfigurationsPath; + oldintrosDirectory = Path.Join(cacheRoot, pluginDirName); + } + + _oldFingerprintCachePath = Path.Join(oldintrosDirectory, pluginCachePath); + _oldintroPath = Path.Join(cacheRoot, pluginDirName, "intros.xml"); + _oldcreditsPath = Path.Join(cacheRoot, pluginDirName, "credits.xml"); // Create the base & cache directories (if needed). if (!Directory.Exists(FingerprintCachePath))