diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/PluginConfiguration.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/PluginConfiguration.cs index 5242088..c712b3b 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/PluginConfiguration.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/PluginConfiguration.cs @@ -31,6 +31,11 @@ public class PluginConfiguration : BasePluginConfiguration /// public EdlAction EdlAction { get; set; } = EdlAction.None; + /// + /// Gets or sets a value indicating whether or not to overwrite existing EDL files. + /// + public bool OverwriteExistingEdlFiles { get; set; } = false; + // ===== Playback settings ===== /// diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/configPage.html b/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/configPage.html index d681ff6..540657a 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/configPage.html +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/configPage.html @@ -70,10 +70,20 @@ If set to a value other than None, specifies which action to write to MPlayer compatible EDL files alongside your episode files.
- - If this value is changed from None, the plugin will overwrite any EDL files - associated with your episode files. - + + If this value is changed after EDL files are generated, you must either manually delete + the EDL files or check the "Overwrite existing EDL files" checkbox below. + + + +
+ + +
+ If checked, the plugin will overwrite any EDL files associated with your episode files.
@@ -477,7 +487,9 @@ ApiClient.getPluginConfiguration("c83d86bb-a1e0-4c35-a113-e2101cf4ee6b").then(function (config) { document.querySelector('#AutoSkip').checked = config.AutoSkip; document.querySelector('#MaxParallelism').value = config.MaxParallelism; + document.querySelector('#EdlAction').value = config.EdlAction; + document.querySelector('#OverwriteEdl').checked = config.OverwriteExistingEdlFiles; document.querySelector('#CacheFingerprints').checked = config.CacheFingerprints; document.querySelector('#ShowPromptAdjustment').value = config.ShowPromptAdjustment; @@ -493,15 +505,18 @@ ApiClient.getPluginConfiguration("c83d86bb-a1e0-4c35-a113-e2101cf4ee6b").then(function (config) { config.AutoSkip = document.querySelector('#AutoSkip').checked; config.MaxParallelism = document.querySelector('#MaxParallelism').value; + config.EdlAction = document.querySelector('#EdlAction').value; + config.OverwriteExistingEdlFiles = document.querySelector('#OverwriteEdl').checked; config.CacheFingerprints = document.querySelector('#CacheFingerprints').checked; config.ShowPromptAdjustment = document.querySelector("#ShowPromptAdjustment").value; config.HidePromptAdjustment = document.querySelector("#HidePromptAdjustment").value; - ApiClient.updatePluginConfiguration("c83d86bb-a1e0-4c35-a113-e2101cf4ee6b", config).then(function (result) { - Dashboard.processPluginConfigurationUpdateResult(result); - }); + ApiClient.updatePluginConfiguration("c83d86bb-a1e0-4c35-a113-e2101cf4ee6b", config) + .then(function (result) { + Dashboard.processPluginConfigurationUpdateResult(result); + }); }); e.preventDefault(); diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/EdlManager.cs b/ConfusedPolarBear.Plugin.IntroSkipper/EdlManager.cs index 6340e0d..38e2d16 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/EdlManager.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/EdlManager.cs @@ -26,6 +26,7 @@ public static class EdlManager /// Episodes to update EDL files for. public static void UpdateEDLFiles(ReadOnlyCollection episodes) { + var overwrite = Plugin.Instance!.Configuration.OverwriteExistingEdlFiles; var action = Plugin.Instance!.Configuration.EdlAction; if (action == EdlAction.None) { @@ -43,6 +44,12 @@ public static class EdlManager _logger?.LogTrace("Episode {Id} has EDL path {Path}", id, edlPath); + if (!overwrite && File.Exists(edlPath)) + { + _logger?.LogTrace("Refusing to overwrite existing EDL file {Path}", edlPath); + continue; + } + File.WriteAllText(edlPath, intro.ToEdl(action)); } }