Remove old Path (#326)
and clean up Co-authored-by: rlauu <46294892+rlauu@users.noreply.github.com>
This commit is contained in:
parent
bed71516ff
commit
8a323144ed
@ -9,8 +9,6 @@ namespace ConfusedPolarBear.Plugin.IntroSkipper.Configuration;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class PluginConfiguration : BasePluginConfiguration
|
public class PluginConfiguration : BasePluginConfiguration
|
||||||
{
|
{
|
||||||
private bool? _selectAllLibraries;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="PluginConfiguration"/> class.
|
/// Initializes a new instance of the <see cref="PluginConfiguration"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -33,11 +31,7 @@ public class PluginConfiguration : BasePluginConfiguration
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a value indicating whether all libraries should be analyzed.
|
/// Gets or sets a value indicating whether all libraries should be analyzed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool SelectAllLibraries
|
public bool SelectAllLibraries { get; set; } = true;
|
||||||
{
|
|
||||||
get => _selectAllLibraries ?? string.IsNullOrEmpty(SelectedLibraries);
|
|
||||||
set => _selectAllLibraries = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the list of client to auto skip for.
|
/// Gets or sets the list of client to auto skip for.
|
||||||
@ -47,17 +41,17 @@ public class PluginConfiguration : BasePluginConfiguration
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a value indicating whether to scan for intros during a scheduled task.
|
/// Gets or sets a value indicating whether to scan for intros during a scheduled task.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool AutoDetectIntros { get; set; } = false;
|
public bool AutoDetectIntros { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a value indicating whether to scan for credits during a scheduled task.
|
/// Gets or sets a value indicating whether to scan for credits during a scheduled task.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool AutoDetectCredits { get; set; } = false;
|
public bool AutoDetectCredits { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a value indicating whether to analyze season 0.
|
/// Gets or sets a value indicating whether to analyze season 0.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool AnalyzeSeasonZero { get; set; } = false;
|
public bool AnalyzeSeasonZero { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a value indicating whether the episode's fingerprint should be cached to the filesystem.
|
/// 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
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the amount of intro at start to play (in seconds).
|
/// Gets or sets the amount of intro at start to play (in seconds).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int SecondsOfIntroStartToPlay { get; set; } = 0;
|
public int SecondsOfIntroStartToPlay { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the amount of credit at start to play (in seconds).
|
/// Gets or sets the amount of credit at start to play (in seconds).
|
||||||
|
@ -70,54 +70,6 @@ public class Plugin : BasePlugin<PluginConfiguration>, IHasWebPages
|
|||||||
_creditsPath = Path.Join(applicationPaths.DataPath, pluginDirName, "credits.xml");
|
_creditsPath = Path.Join(applicationPaths.DataPath, pluginDirName, "credits.xml");
|
||||||
_ignorelistPath = Path.Join(applicationPaths.DataPath, pluginDirName, "ignorelist.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
|
// migrate from XMLSchema to DataContract
|
||||||
XmlSerializationHelper.MigrateXML(_introPath);
|
XmlSerializationHelper.MigrateXML(_introPath);
|
||||||
XmlSerializationHelper.MigrateXML(_creditsPath);
|
XmlSerializationHelper.MigrateXML(_creditsPath);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user