mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-19 13:10:13 -07:00
New: Add stopped option for rTorrent
Co-Authored-By: Mark McDowall <markus101@users.noreply.github.com>
This commit is contained in:
parent
ba96dad8c7
commit
9a1660da51
3 changed files with 36 additions and 7 deletions
|
@ -2,7 +2,7 @@ namespace NzbDrone.Core.Download.Clients.RTorrent
|
||||||
{
|
{
|
||||||
public enum RTorrentPriority
|
public enum RTorrentPriority
|
||||||
{
|
{
|
||||||
DoNotDownload = 0,
|
VeryLow = 0,
|
||||||
Low = 1,
|
Low = 1,
|
||||||
Normal = 2,
|
Normal = 2,
|
||||||
High = 3
|
High = 3
|
||||||
|
|
|
@ -26,9 +26,15 @@ namespace NzbDrone.Core.Download.Clients.RTorrent
|
||||||
[XmlRpcMethod("d.multicall2")]
|
[XmlRpcMethod("d.multicall2")]
|
||||||
object[] TorrentMulticall(params string[] parameters);
|
object[] TorrentMulticall(params string[] parameters);
|
||||||
|
|
||||||
|
[XmlRpcMethod("load.normal")]
|
||||||
|
int LoadNormal(string target, string data, params string[] commands);
|
||||||
|
|
||||||
[XmlRpcMethod("load.start")]
|
[XmlRpcMethod("load.start")]
|
||||||
int LoadStart(string target, string data, params string[] commands);
|
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")]
|
[XmlRpcMethod("load.raw_start")]
|
||||||
int LoadRawStart(string target, byte[] data, params string[] commands);
|
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)
|
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 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)
|
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)
|
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 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)
|
if (response != 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -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 albums released over 14 days ago")]
|
[FieldDefinition(9, Label = "Older Priority", Type = FieldType.Select, SelectOptions = typeof(RTorrentPriority), HelpText = "Priority to use when grabbing albums released over 14 days ago")]
|
||||||
public int OlderTvPriority { get; set; }
|
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()
|
public NzbDroneValidationResult Validate()
|
||||||
{
|
{
|
||||||
return new NzbDroneValidationResult(Validator.Validate(this));
|
return new NzbDroneValidationResult(Validator.Validate(this));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue