diff --git a/src/NzbDrone.Core/Download/Clients/rTorrent/RTorrentPriority.cs b/src/NzbDrone.Core/Download/Clients/rTorrent/RTorrentPriority.cs index 99b289e8e..9ae5395d3 100644 --- a/src/NzbDrone.Core/Download/Clients/rTorrent/RTorrentPriority.cs +++ b/src/NzbDrone.Core/Download/Clients/rTorrent/RTorrentPriority.cs @@ -2,7 +2,7 @@ namespace NzbDrone.Core.Download.Clients.RTorrent { public enum RTorrentPriority { - DoNotDownload = 0, + VeryLow = 0, Low = 1, Normal = 2, High = 3 diff --git a/src/NzbDrone.Core/Download/Clients/rTorrent/RTorrentProxy.cs b/src/NzbDrone.Core/Download/Clients/rTorrent/RTorrentProxy.cs index 68a0f80ea..ff9a4332f 100644 --- a/src/NzbDrone.Core/Download/Clients/rTorrent/RTorrentProxy.cs +++ b/src/NzbDrone.Core/Download/Clients/rTorrent/RTorrentProxy.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Net; @@ -26,9 +26,15 @@ namespace NzbDrone.Core.Download.Clients.RTorrent [XmlRpcMethod("d.multicall2")] object[] TorrentMulticall(params string[] parameters); + [XmlRpcMethod("load.normal")] + int LoadNormal(string target, string data, params string[] commands); + [XmlRpcMethod("load.start")] int LoadStart(string target, string data, params string[] commands); + [XmlRpcMethod("load.raw")] + int LoadRaw(string target, byte[] data, params string[] commands); + [XmlRpcMethod("load.raw_start")] int LoadRawStart(string target, byte[] data, params string[] commands); @@ -107,10 +113,20 @@ namespace NzbDrone.Core.Download.Clients.RTorrent public void AddTorrentFromUrl(string torrentUrl, string label, RTorrentPriority priority, string directory, RTorrentSettings settings) { - _logger.Debug("Executing remote method: load.normal"); - var client = BuildClient(settings); - var response = ExecuteRequest(() => client.LoadStart("", torrentUrl, GetCommands(label, priority, directory))); + var response = ExecuteRequest(() => + { + if (settings.AddStopped) + { + _logger.Debug("Executing remote method: load.normal"); + return client.LoadNormal("", torrentUrl, GetCommands(label, priority, directory)); + } + else + { + _logger.Debug("Executing remote method: load.start"); + return client.LoadStart("", torrentUrl, GetCommands(label, priority, directory)); + } + }); if (response != 0) { @@ -120,10 +136,20 @@ namespace NzbDrone.Core.Download.Clients.RTorrent public void AddTorrentFromFile(string fileName, byte[] fileContent, string label, RTorrentPriority priority, string directory, RTorrentSettings settings) { - _logger.Debug("Executing remote method: load.raw"); - var client = BuildClient(settings); - var response = ExecuteRequest(() => client.LoadRawStart("", fileContent, GetCommands(label, priority, directory))); + var response = ExecuteRequest(() => + { + if (settings.AddStopped) + { + _logger.Debug("Executing remote method: load.raw"); + return client.LoadRaw("", fileContent, GetCommands(label, priority, directory)); + } + else + { + _logger.Debug("Executing remote method: load.raw_start"); + return client.LoadRawStart("", fileContent, GetCommands(label, priority, directory)); + } + }); if (response != 0) { diff --git a/src/NzbDrone.Core/Download/Clients/rTorrent/RTorrentSettings.cs b/src/NzbDrone.Core/Download/Clients/rTorrent/RTorrentSettings.cs index dba98c99a..67a040105 100644 --- a/src/NzbDrone.Core/Download/Clients/rTorrent/RTorrentSettings.cs +++ b/src/NzbDrone.Core/Download/Clients/rTorrent/RTorrentSettings.cs @@ -1,4 +1,4 @@ -using FluentValidation; +using FluentValidation; using NzbDrone.Core.Annotations; using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.Validation; @@ -61,6 +61,9 @@ namespace NzbDrone.Core.Download.Clients.RTorrent [FieldDefinition(9, Label = "Older Priority", Type = FieldType.Select, SelectOptions = typeof(RTorrentPriority), HelpText = "Priority to use when grabbing episodes that aired over 14 days ago")] public int OlderTvPriority { get; set; } + [FieldDefinition(10, Label = "Add Stopped", Type = FieldType.Checkbox, HelpText = "Enabling will prevent magnets from downloading before downloading")] + public bool AddStopped { get; set; } + public NzbDroneValidationResult Validate() { return new NzbDroneValidationResult(Validator.Validate(this));