From 69ed5318507db8b13c5c9db02568c80dd19c505a Mon Sep 17 00:00:00 2001 From: Qstick Date: Wed, 11 Nov 2020 23:20:07 -0500 Subject: [PATCH] Fixed: False Positives for RemotePath check with Deluge (cherry picked from commit b888b044d61c3787ce658963c6e5c3ef6f3323a1) --- .../Download/Clients/Deluge/Deluge.cs | 15 ++++++++++++--- .../Download/Clients/Deluge/DelugeLabel.cs | 16 ++++++++++++++++ .../Download/Clients/Deluge/DelugeProxy.cs | 8 ++++++++ 3 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 src/NzbDrone.Core/Download/Clients/Deluge/DelugeLabel.cs diff --git a/src/NzbDrone.Core/Download/Clients/Deluge/Deluge.cs b/src/NzbDrone.Core/Download/Clients/Deluge/Deluge.cs index 787503b16..39a191089 100644 --- a/src/NzbDrone.Core/Download/Clients/Deluge/Deluge.cs +++ b/src/NzbDrone.Core/Download/Clients/Deluge/Deluge.cs @@ -196,13 +196,22 @@ namespace NzbDrone.Core.Download.Clients.Deluge public override DownloadClientInfo GetStatus() { var config = _proxy.GetConfig(Settings); + var label = _proxy.GetLabelOptions(Settings); + OsPath destDir; - var destDir = new OsPath(config.GetValueOrDefault("download_location") as string); - - if (config.GetValueOrDefault("move_completed", false).ToString() == "True") + if (label != null && label.ApplyMoveCompleted && label.MoveCompleted) + { + // if label exists and a label completed path exists and is enabled use it instead of global + destDir = new OsPath(label.MoveCompletedPath); + } + else if (config.GetValueOrDefault("move_completed", false).ToString() == "True") { destDir = new OsPath(config.GetValueOrDefault("move_completed_path") as string); } + else + { + destDir = new OsPath(config.GetValueOrDefault("download_location") as string); + } var status = new DownloadClientInfo { diff --git a/src/NzbDrone.Core/Download/Clients/Deluge/DelugeLabel.cs b/src/NzbDrone.Core/Download/Clients/Deluge/DelugeLabel.cs new file mode 100644 index 000000000..3d95413c5 --- /dev/null +++ b/src/NzbDrone.Core/Download/Clients/Deluge/DelugeLabel.cs @@ -0,0 +1,16 @@ +using Newtonsoft.Json; + +namespace NzbDrone.Core.Download.Clients.Deluge +{ + public class DelugeLabel + { + [JsonProperty(PropertyName = "apply_move_completed")] + public bool ApplyMoveCompleted { get; set; } + + [JsonProperty(PropertyName = "move_completed")] + public bool MoveCompleted { get; set; } + + [JsonProperty(PropertyName = "move_completed_path")] + public string MoveCompletedPath { get; set; } + } +} diff --git a/src/NzbDrone.Core/Download/Clients/Deluge/DelugeProxy.cs b/src/NzbDrone.Core/Download/Clients/Deluge/DelugeProxy.cs index 6ab45ec40..cf35b8adb 100644 --- a/src/NzbDrone.Core/Download/Clients/Deluge/DelugeProxy.cs +++ b/src/NzbDrone.Core/Download/Clients/Deluge/DelugeProxy.cs @@ -19,6 +19,7 @@ namespace NzbDrone.Core.Download.Clients.Deluge string[] GetAvailablePlugins(DelugeSettings settings); string[] GetEnabledPlugins(DelugeSettings settings); string[] GetAvailableLabels(DelugeSettings settings); + DelugeLabel GetLabelOptions(DelugeSettings settings); void SetTorrentLabel(string hash, string label, DelugeSettings settings); void SetTorrentConfiguration(string hash, string key, object value, DelugeSettings settings); void SetTorrentSeedingConfiguration(string hash, TorrentSeedConfiguration seedConfiguration, DelugeSettings settings); @@ -157,6 +158,13 @@ namespace NzbDrone.Core.Download.Clients.Deluge return response; } + public DelugeLabel GetLabelOptions(DelugeSettings settings) + { + var response = ProcessRequest(settings, "label.get_options", settings.TvCategory); + + return response; + } + public void SetTorrentConfiguration(string hash, string key, object value, DelugeSettings settings) { var arguments = new Dictionary();