parent
bea4954de9
commit
19a4d3536b
|
@ -49,14 +49,7 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
|
||||||
_proxy.MoveTorrentToTopInQueue(hash, Settings);
|
_proxy.MoveTorrentToTopInQueue(hash, Settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Settings.AddStopped)
|
_proxy.SetState(hash, (UTorrentState)Settings.IntialState, Settings);
|
||||||
{
|
|
||||||
_proxy.StopTorrent(hash, Settings);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_proxy.StartTorrent(hash, Settings);
|
|
||||||
}
|
|
||||||
|
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
@ -74,14 +67,7 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
|
||||||
_proxy.MoveTorrentToTopInQueue(hash, Settings);
|
_proxy.MoveTorrentToTopInQueue(hash, Settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Settings.AddStopped)
|
_proxy.SetState(hash, (UTorrentState)Settings.IntialState, Settings);
|
||||||
{
|
|
||||||
_proxy.StopTorrent(hash, Settings);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_proxy.StartTorrent(hash, Settings);
|
|
||||||
}
|
|
||||||
|
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,8 +22,7 @@ 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 SetState(string hash, UTorrentState state, UTorrentSettings settings);
|
||||||
void StopTorrent(string hash, UTorrentSettings settings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class UTorrentProxy : IUTorrentProxy
|
public class UTorrentProxy : IUTorrentProxy
|
||||||
|
@ -159,19 +158,10 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
|
||||||
ProcessRequest(requestBuilder, settings);
|
ProcessRequest(requestBuilder, settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StartTorrent(string hash, UTorrentSettings settings)
|
public void SetState(string hash, UTorrentState state, UTorrentSettings settings)
|
||||||
{
|
{
|
||||||
var requestBuilder = BuildRequest(settings)
|
var requestBuilder = BuildRequest(settings)
|
||||||
.AddQueryParam("action", "start")
|
.AddQueryParam("action", state.ToString().ToLowerInvariant())
|
||||||
.AddQueryParam("hash", hash);
|
|
||||||
|
|
||||||
ProcessRequest(requestBuilder, settings);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void StopTorrent(string hash, UTorrentSettings settings)
|
|
||||||
{
|
|
||||||
var requestBuilder = BuildRequest(settings)
|
|
||||||
.AddQueryParam("action", "stop")
|
|
||||||
.AddQueryParam("hash", hash);
|
.AddQueryParam("hash", hash);
|
||||||
|
|
||||||
ProcessRequest(requestBuilder, settings);
|
ProcessRequest(requestBuilder, settings);
|
||||||
|
|
|
@ -47,8 +47,8 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
|
||||||
[FieldDefinition(6, Label = "Older Priority", Type = FieldType.Select, SelectOptions = typeof(UTorrentPriority), HelpText = "Priority to use when grabbing episodes that aired over 14 days ago")]
|
[FieldDefinition(6, Label = "Older Priority", Type = FieldType.Select, SelectOptions = typeof(UTorrentPriority), HelpText = "Priority to use when grabbing episodes that aired 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")]
|
[FieldDefinition(7, Label = "Initial State", Type = FieldType.Select, SelectOptions = typeof(UTorrentState), HelpText = "Initial state for torrents added to uTorrent")]
|
||||||
public bool AddStopped { get; set; }
|
public int IntialState { get; set; }
|
||||||
|
|
||||||
public NzbDroneValidationResult Validate()
|
public NzbDroneValidationResult Validate()
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
namespace NzbDrone.Core.Download.Clients.UTorrent
|
||||||
|
{
|
||||||
|
public enum UTorrentState
|
||||||
|
{
|
||||||
|
Start = 0,
|
||||||
|
ForceStart = 1,
|
||||||
|
Pause = 2,
|
||||||
|
Stop = 3
|
||||||
|
}
|
||||||
|
}
|
|
@ -495,6 +495,7 @@
|
||||||
<Compile Include="Download\Clients\uTorrent\UTorrentProxy.cs" />
|
<Compile Include="Download\Clients\uTorrent\UTorrentProxy.cs" />
|
||||||
<Compile Include="Download\Clients\uTorrent\UTorrentResponse.cs" />
|
<Compile Include="Download\Clients\uTorrent\UTorrentResponse.cs" />
|
||||||
<Compile Include="Download\Clients\uTorrent\UTorrentSettings.cs" />
|
<Compile Include="Download\Clients\uTorrent\UTorrentSettings.cs" />
|
||||||
|
<Compile Include="Download\Clients\uTorrent\UtorrentState.cs" />
|
||||||
<Compile Include="Download\Clients\uTorrent\UTorrentTorrent.cs" />
|
<Compile Include="Download\Clients\uTorrent\UTorrentTorrent.cs" />
|
||||||
<Compile Include="Download\Clients\uTorrent\UTorrentTorrentCache.cs" />
|
<Compile Include="Download\Clients\uTorrent\UTorrentTorrentCache.cs" />
|
||||||
<Compile Include="Download\Clients\uTorrent\UTorrentTorrentStatus.cs" />
|
<Compile Include="Download\Clients\uTorrent\UTorrentTorrentStatus.cs" />
|
||||||
|
|
Loading…
Reference in New Issue