Make overwriting existing EDL files optional
This commit is contained in:
parent
9dbe684790
commit
b83fcdd3a1
@ -31,6 +31,11 @@ public class PluginConfiguration : BasePluginConfiguration
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public EdlAction EdlAction { get; set; } = EdlAction.None;
|
public EdlAction EdlAction { get; set; } = EdlAction.None;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether or not to overwrite existing EDL files.
|
||||||
|
/// </summary>
|
||||||
|
public bool OverwriteExistingEdlFiles { get; set; } = false;
|
||||||
|
|
||||||
// ===== Playback settings =====
|
// ===== Playback settings =====
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -70,10 +70,20 @@
|
|||||||
If set to a value other than None, specifies which action to write to
|
If set to a value other than None, specifies which action to write to
|
||||||
<a href="https://kodi.wiki/view/Edit_decision_list">MPlayer compatible EDL files</a>
|
<a href="https://kodi.wiki/view/Edit_decision_list">MPlayer compatible EDL files</a>
|
||||||
alongside your episode files. <br />
|
alongside your episode files. <br />
|
||||||
<strong>
|
|
||||||
If this value is changed from None, the plugin will overwrite any EDL files
|
If this value is changed after EDL files are generated, you must either manually delete
|
||||||
associated with your episode files.
|
the EDL files or check the "Overwrite existing EDL files" checkbox below.
|
||||||
</strong>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="checkboxContainer checkboxContainer-withDescription">
|
||||||
|
<label class="emby-checkbox-label">
|
||||||
|
<input id="OverwriteEdl" type="checkbox" is="emby-checkbox" />
|
||||||
|
<span>Overwrite existing EDL files</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<div class="fieldDescription">
|
||||||
|
If checked, the plugin will overwrite any EDL files associated with your episode files.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
@ -477,7 +487,9 @@
|
|||||||
ApiClient.getPluginConfiguration("c83d86bb-a1e0-4c35-a113-e2101cf4ee6b").then(function (config) {
|
ApiClient.getPluginConfiguration("c83d86bb-a1e0-4c35-a113-e2101cf4ee6b").then(function (config) {
|
||||||
document.querySelector('#AutoSkip').checked = config.AutoSkip;
|
document.querySelector('#AutoSkip').checked = config.AutoSkip;
|
||||||
document.querySelector('#MaxParallelism').value = config.MaxParallelism;
|
document.querySelector('#MaxParallelism').value = config.MaxParallelism;
|
||||||
|
|
||||||
document.querySelector('#EdlAction').value = config.EdlAction;
|
document.querySelector('#EdlAction').value = config.EdlAction;
|
||||||
|
document.querySelector('#OverwriteEdl').checked = config.OverwriteExistingEdlFiles;
|
||||||
|
|
||||||
document.querySelector('#CacheFingerprints').checked = config.CacheFingerprints;
|
document.querySelector('#CacheFingerprints').checked = config.CacheFingerprints;
|
||||||
document.querySelector('#ShowPromptAdjustment').value = config.ShowPromptAdjustment;
|
document.querySelector('#ShowPromptAdjustment').value = config.ShowPromptAdjustment;
|
||||||
@ -493,15 +505,18 @@
|
|||||||
ApiClient.getPluginConfiguration("c83d86bb-a1e0-4c35-a113-e2101cf4ee6b").then(function (config) {
|
ApiClient.getPluginConfiguration("c83d86bb-a1e0-4c35-a113-e2101cf4ee6b").then(function (config) {
|
||||||
config.AutoSkip = document.querySelector('#AutoSkip').checked;
|
config.AutoSkip = document.querySelector('#AutoSkip').checked;
|
||||||
config.MaxParallelism = document.querySelector('#MaxParallelism').value;
|
config.MaxParallelism = document.querySelector('#MaxParallelism').value;
|
||||||
|
|
||||||
config.EdlAction = document.querySelector('#EdlAction').value;
|
config.EdlAction = document.querySelector('#EdlAction').value;
|
||||||
|
config.OverwriteExistingEdlFiles = document.querySelector('#OverwriteEdl').checked;
|
||||||
|
|
||||||
config.CacheFingerprints = document.querySelector('#CacheFingerprints').checked;
|
config.CacheFingerprints = document.querySelector('#CacheFingerprints').checked;
|
||||||
config.ShowPromptAdjustment = document.querySelector("#ShowPromptAdjustment").value;
|
config.ShowPromptAdjustment = document.querySelector("#ShowPromptAdjustment").value;
|
||||||
config.HidePromptAdjustment = document.querySelector("#HidePromptAdjustment").value;
|
config.HidePromptAdjustment = document.querySelector("#HidePromptAdjustment").value;
|
||||||
|
|
||||||
ApiClient.updatePluginConfiguration("c83d86bb-a1e0-4c35-a113-e2101cf4ee6b", config).then(function (result) {
|
ApiClient.updatePluginConfiguration("c83d86bb-a1e0-4c35-a113-e2101cf4ee6b", config)
|
||||||
Dashboard.processPluginConfigurationUpdateResult(result);
|
.then(function (result) {
|
||||||
});
|
Dashboard.processPluginConfigurationUpdateResult(result);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
@ -26,6 +26,7 @@ public static class EdlManager
|
|||||||
/// <param name="episodes">Episodes to update EDL files for.</param>
|
/// <param name="episodes">Episodes to update EDL files for.</param>
|
||||||
public static void UpdateEDLFiles(ReadOnlyCollection<QueuedEpisode> episodes)
|
public static void UpdateEDLFiles(ReadOnlyCollection<QueuedEpisode> episodes)
|
||||||
{
|
{
|
||||||
|
var overwrite = Plugin.Instance!.Configuration.OverwriteExistingEdlFiles;
|
||||||
var action = Plugin.Instance!.Configuration.EdlAction;
|
var action = Plugin.Instance!.Configuration.EdlAction;
|
||||||
if (action == EdlAction.None)
|
if (action == EdlAction.None)
|
||||||
{
|
{
|
||||||
@ -43,6 +44,12 @@ public static class EdlManager
|
|||||||
|
|
||||||
_logger?.LogTrace("Episode {Id} has EDL path {Path}", id, edlPath);
|
_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));
|
File.WriteAllText(edlPath, intro.ToEdl(action));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user