mirror of https://github.com/Sonarr/Sonarr
New: Add stopped option for rTorrent
This commit is contained in:
parent
ff9a9a5e4d
commit
ca22a25842
|
@ -2,7 +2,7 @@ namespace NzbDrone.Core.Download.Clients.RTorrent
|
|||
{
|
||||
public enum RTorrentPriority
|
||||
{
|
||||
DoNotDownload = 0,
|
||||
VeryLow = 0,
|
||||
Low = 1,
|
||||
Normal = 2,
|
||||
High = 3
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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));
|
||||
|
|
Loading…
Reference in New Issue