From 8a323144ed3a2cd433d8894f7154e74786342b9b Mon Sep 17 00:00:00 2001 From: rlauuzo <46294892+rlauuzo@users.noreply.github.com> Date: Sat, 5 Oct 2024 18:15:48 +0200 Subject: [PATCH] Remove old Path (#326) and clean up Co-authored-by: rlauu <46294892+rlauu@users.noreply.github.com> --- .../Configuration/PluginConfiguration.cs | 16 ++----- .../Plugin.cs | 48 ------------------- 2 files changed, 5 insertions(+), 59 deletions(-) diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/PluginConfiguration.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/PluginConfiguration.cs index 9ac2e65..356408b 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/PluginConfiguration.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/PluginConfiguration.cs @@ -9,8 +9,6 @@ namespace ConfusedPolarBear.Plugin.IntroSkipper.Configuration; /// public class PluginConfiguration : BasePluginConfiguration { - private bool? _selectAllLibraries; - /// /// Initializes a new instance of the class. /// @@ -33,11 +31,7 @@ public class PluginConfiguration : BasePluginConfiguration /// /// Gets or sets a value indicating whether all libraries should be analyzed. /// - public bool SelectAllLibraries - { - get => _selectAllLibraries ?? string.IsNullOrEmpty(SelectedLibraries); - set => _selectAllLibraries = value; - } + public bool SelectAllLibraries { get; set; } = true; /// /// Gets or sets the list of client to auto skip for. @@ -47,17 +41,17 @@ public class PluginConfiguration : BasePluginConfiguration /// /// Gets or sets a value indicating whether to scan for intros during a scheduled task. /// - public bool AutoDetectIntros { get; set; } = false; + public bool AutoDetectIntros { get; set; } /// /// Gets or sets a value indicating whether to scan for credits during a scheduled task. /// - public bool AutoDetectCredits { get; set; } = false; + public bool AutoDetectCredits { get; set; } /// /// Gets or sets a value indicating whether to analyze season 0. /// - public bool AnalyzeSeasonZero { get; set; } = false; + public bool AnalyzeSeasonZero { get; set; } /// /// Gets or sets a value indicating whether the episode's fingerprint should be cached to the filesystem. @@ -182,7 +176,7 @@ public class PluginConfiguration : BasePluginConfiguration /// /// Gets or sets the amount of intro at start to play (in seconds). /// - public int SecondsOfIntroStartToPlay { get; set; } = 0; + public int SecondsOfIntroStartToPlay { get; set; } /// /// Gets or sets the amount of credit at start to play (in seconds). diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Plugin.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Plugin.cs index 3a66d85..87b5ca4 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Plugin.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Plugin.cs @@ -70,54 +70,6 @@ public class Plugin : BasePlugin, IHasWebPages _creditsPath = Path.Join(applicationPaths.DataPath, pluginDirName, "credits.xml"); _ignorelistPath = Path.Join(applicationPaths.DataPath, pluginDirName, "ignorelist.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); - } - - var oldFingerprintCachePath = Path.Join(oldIntrosDirectory, pluginCachePath); - var oldIntroPath = Path.Join(cacheRoot, pluginDirName, "intros.xml"); - var oldCreditsPath = Path.Join(cacheRoot, pluginDirName, "credits.xml"); - - // Create the base & cache directories (if needed). - if (!Directory.Exists(FingerprintCachePath)) - { - Directory.CreateDirectory(FingerprintCachePath); - - // Check if the old cache directory exists - if (Directory.Exists(oldFingerprintCachePath)) - { - // move intro.xml if exists - if (File.Exists(oldIntroPath)) - { - File.Move(oldIntroPath, _introPath); - } - - // move credits.xml if exists - if (File.Exists(oldCreditsPath)) - { - File.Move(oldCreditsPath, _creditsPath); - } - - // Move the contents from old directory to new directory - string[] files = Directory.GetFiles(oldFingerprintCachePath); - foreach (string file in files) - { - string fileName = Path.GetFileName(file); - string destFile = Path.Combine(FingerprintCachePath, fileName); - File.Move(file, destFile); - } - - // Optionally, you may delete the old directory after moving its contents - Directory.Delete(oldIntrosDirectory, true); - } - } - // migrate from XMLSchema to DataContract XmlSerializationHelper.MigrateXML(_introPath); XmlSerializationHelper.MigrateXML(_creditsPath);