mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-21 05:53:33 -07:00
New: Start torrents added to uTorrent by default, add option
This commit is contained in:
parent
be6f89cd76
commit
967839154c
3 changed files with 42 additions and 1 deletions
|
@ -49,6 +49,15 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
|
||||||
_proxy.MoveTorrentToTopInQueue(hash, Settings);
|
_proxy.MoveTorrentToTopInQueue(hash, Settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Settings.AddStopped)
|
||||||
|
{
|
||||||
|
_proxy.StopTorrent(hash, Settings);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_proxy.StartTorrent(hash, Settings);
|
||||||
|
}
|
||||||
|
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,6 +74,15 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
|
||||||
_proxy.MoveTorrentToTopInQueue(hash, Settings);
|
_proxy.MoveTorrentToTopInQueue(hash, Settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Settings.AddStopped)
|
||||||
|
{
|
||||||
|
_proxy.StopTorrent(hash, Settings);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_proxy.StartTorrent(hash, Settings);
|
||||||
|
}
|
||||||
|
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,8 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
|
||||||
void RemoveTorrent(string hash, bool removeData, UTorrentSettings settings);
|
void RemoveTorrent(string hash, bool removeData, UTorrentSettings settings);
|
||||||
void SetTorrentLabel(string hash, string label, UTorrentSettings settings);
|
void SetTorrentLabel(string hash, string label, UTorrentSettings settings);
|
||||||
void MoveTorrentToTopInQueue(string hash, UTorrentSettings settings);
|
void MoveTorrentToTopInQueue(string hash, UTorrentSettings settings);
|
||||||
|
void StartTorrent(string hash, UTorrentSettings settings);
|
||||||
|
void StopTorrent(string hash, UTorrentSettings settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class UTorrentProxy : IUTorrentProxy
|
public class UTorrentProxy : IUTorrentProxy
|
||||||
|
@ -157,6 +159,24 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
|
||||||
ProcessRequest(requestBuilder, settings);
|
ProcessRequest(requestBuilder, settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void StartTorrent(string hash, UTorrentSettings settings)
|
||||||
|
{
|
||||||
|
var requestBuilder = BuildRequest(settings)
|
||||||
|
.AddQueryParam("action", "start")
|
||||||
|
.AddQueryParam("hash", hash);
|
||||||
|
|
||||||
|
ProcessRequest(requestBuilder, settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void StopTorrent(string hash, UTorrentSettings settings)
|
||||||
|
{
|
||||||
|
var requestBuilder = BuildRequest(settings)
|
||||||
|
.AddQueryParam("action", "stop")
|
||||||
|
.AddQueryParam("hash", hash);
|
||||||
|
|
||||||
|
ProcessRequest(requestBuilder, settings);
|
||||||
|
}
|
||||||
|
|
||||||
private HttpRequestBuilder BuildRequest(UTorrentSettings settings)
|
private HttpRequestBuilder BuildRequest(UTorrentSettings settings)
|
||||||
{
|
{
|
||||||
var requestBuilder = new HttpRequestBuilder(false, settings.Host, settings.Port)
|
var requestBuilder = new HttpRequestBuilder(false, settings.Host, settings.Port)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using FluentValidation;
|
using FluentValidation;
|
||||||
using NzbDrone.Core.Annotations;
|
using NzbDrone.Core.Annotations;
|
||||||
using NzbDrone.Core.ThingiProvider;
|
using NzbDrone.Core.ThingiProvider;
|
||||||
using NzbDrone.Core.Validation;
|
using NzbDrone.Core.Validation;
|
||||||
|
@ -47,6 +47,9 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
|
||||||
[FieldDefinition(6, Label = "Older Priority", Type = FieldType.Select, SelectOptions = typeof(UTorrentPriority), HelpText = "Priority to use when grabbing albums released over 14 days ago")]
|
[FieldDefinition(6, Label = "Older Priority", Type = FieldType.Select, SelectOptions = typeof(UTorrentPriority), HelpText = "Priority to use when grabbing albums released over 14 days ago")]
|
||||||
public int OlderTvPriority { get; set; }
|
public int OlderTvPriority { get; set; }
|
||||||
|
|
||||||
|
[FieldDefinition(7, Label = "Add Stopped", Type = FieldType.Checkbox, SelectOptions = typeof(UTorrentPriority), HelpText = "Torrents will need to be started manually in uTorrent")]
|
||||||
|
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