diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/UTorrentTests/UTorrentFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/UTorrentTests/UTorrentFixture.cs
index 8b0196347..1d8d0a43c 100644
--- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/UTorrentTests/UTorrentFixture.cs
+++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/UTorrentTests/UTorrentFixture.cs
@@ -30,7 +30,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.UTorrentTests
Port = 2222,
Username = "admin",
Password = "pass",
- TvCategory = "tv"
+ MovieCategory = "movie"
};
_queued = new UTorrentTorrent
@@ -41,7 +41,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.UTorrentTests
Size = 1000,
Remaining = 1000,
Progress = 0,
- Label = "tv",
+ Label = "movie",
DownloadUrl = _downloadUrl,
RootDownloadPath = "somepath"
};
@@ -54,7 +54,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.UTorrentTests
Size = 1000,
Remaining = 100,
Progress = 0.9,
- Label = "tv",
+ Label = "movie",
DownloadUrl = _downloadUrl,
RootDownloadPath = "somepath"
};
@@ -67,7 +67,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.UTorrentTests
Size = 1000,
Remaining = 100,
Progress = 0.9,
- Label = "tv",
+ Label = "movie",
DownloadUrl = _downloadUrl,
RootDownloadPath = "somepath"
};
@@ -80,7 +80,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.UTorrentTests
Size = 1000,
Remaining = 0,
Progress = 1.0,
- Label = "tv",
+ Label = "movie",
DownloadUrl = _downloadUrl,
RootDownloadPath = "somepath"
};
diff --git a/src/NzbDrone.Core/Download/Clients/uTorrent/UTorrent.cs b/src/NzbDrone.Core/Download/Clients/uTorrent/UTorrent.cs
index eff3a5850..d868ed597 100644
--- a/src/NzbDrone.Core/Download/Clients/uTorrent/UTorrent.cs
+++ b/src/NzbDrone.Core/Download/Clients/uTorrent/UTorrent.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Linq;
using System.Collections.Generic;
using NzbDrone.Common.Disk;
@@ -49,7 +49,7 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
protected override string AddFromMagnetLink(RemoteMovie remoteMovie, string hash, string magnetLink)
{
_proxy.AddTorrentFromUrl(magnetLink, Settings);
- _proxy.SetTorrentLabel(hash, Settings.TvCategory, Settings);
+ _proxy.SetTorrentLabel(hash, Settings.MovieCategory, Settings);
/*var isRecentEpisode = remoteEpisode.IsRecentEpisode();
@@ -59,13 +59,15 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
_proxy.MoveTorrentToTopInQueue(hash, Settings);
}*/
+ _proxy.SetState(hash, (UTorrentState)Settings.IntialState, Settings);
+
return hash;
}
protected override string AddFromTorrentFile(RemoteMovie remoteMovie, string hash, string filename, byte[] fileContent)
{
_proxy.AddTorrentFromFile(filename, fileContent, Settings);
- _proxy.SetTorrentLabel(hash, Settings.TvCategory, Settings);
+ _proxy.SetTorrentLabel(hash, Settings.MovieCategory, Settings);
/*var isRecentEpisode = remoteEpisode.IsRecentEpisode();
@@ -75,6 +77,8 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
_proxy.MoveTorrentToTopInQueue(hash, Settings);
}*/
+ _proxy.SetState(hash, (UTorrentState)Settings.IntialState, Settings);
+
return hash;
}
@@ -86,7 +90,7 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
try
{
- var cacheKey = string.Format("{0}:{1}:{2}", Settings.Host, Settings.Port, Settings.TvCategory);
+ var cacheKey = string.Format("{0}:{1}:{2}", Settings.Host, Settings.Port, Settings.MovieCategory);
var cache = _torrentCache.Find(cacheKey);
var response = _proxy.GetTorrents(cache == null ? null : cache.CacheID, Settings);
@@ -123,7 +127,7 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
foreach (var torrent in torrents)
{
- if (torrent.Label != Settings.TvCategory)
+ if (torrent.Label != Settings.MovieCategory)
{
continue;
}
@@ -205,7 +209,7 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
if (config.GetValueOrDefault("dir_add_label") == "true")
{
- destDir = destDir + Settings.TvCategory;
+ destDir = destDir + Settings.MovieCategory;
}
}
diff --git a/src/NzbDrone.Core/Download/Clients/uTorrent/UTorrentProxy.cs b/src/NzbDrone.Core/Download/Clients/uTorrent/UTorrentProxy.cs
index 64117f328..f4bf160cb 100644
--- a/src/NzbDrone.Core/Download/Clients/uTorrent/UTorrentProxy.cs
+++ b/src/NzbDrone.Core/Download/Clients/uTorrent/UTorrentProxy.cs
@@ -22,6 +22,7 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
void RemoveTorrent(string hash, bool removeData, UTorrentSettings settings);
void SetTorrentLabel(string hash, string label, UTorrentSettings settings);
void MoveTorrentToTopInQueue(string hash, UTorrentSettings settings);
+ void SetState(string hash, UTorrentState state, UTorrentSettings settings);
}
public class UTorrentProxy : IUTorrentProxy
@@ -157,6 +158,15 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
ProcessRequest(requestBuilder, settings);
}
+ public void SetState(string hash, UTorrentState state, UTorrentSettings settings)
+ {
+ var requestBuilder = BuildRequest(settings)
+ .AddQueryParam("action", state.ToString().ToLowerInvariant())
+ .AddQueryParam("hash", hash);
+
+ ProcessRequest(requestBuilder, settings);
+ }
+
private HttpRequestBuilder BuildRequest(UTorrentSettings settings)
{
var requestBuilder = new HttpRequestBuilder(false, settings.Host, settings.Port)
diff --git a/src/NzbDrone.Core/Download/Clients/uTorrent/UTorrentSettings.cs b/src/NzbDrone.Core/Download/Clients/uTorrent/UTorrentSettings.cs
index e1754493c..ae21c4a00 100644
--- a/src/NzbDrone.Core/Download/Clients/uTorrent/UTorrentSettings.cs
+++ b/src/NzbDrone.Core/Download/Clients/uTorrent/UTorrentSettings.cs
@@ -11,7 +11,7 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
{
RuleFor(c => c.Host).ValidHost();
RuleFor(c => c.Port).InclusiveBetween(1, 65535);
- RuleFor(c => c.TvCategory).NotEmpty();
+ RuleFor(c => c.MovieCategory).NotEmpty();
}
}
@@ -22,8 +22,8 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
public UTorrentSettings()
{
Host = "localhost";
- Port = 9091;
- TvCategory = "radarr";
+ Port = 8080;
+ MovieCategory = "radarr";
}
[FieldDefinition(0, Label = "Host", Type = FieldType.Textbox)]
@@ -39,7 +39,7 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
public string Password { get; set; }
[FieldDefinition(4, Label = "Category", Type = FieldType.Textbox, HelpText = "Adding a category specific to Radarr avoids conflicts with unrelated downloads, but it's optional")]
- public string TvCategory { get; set; }
+ public string MovieCategory { get; set; }
[FieldDefinition(5, Label = "Recent Priority", Type = FieldType.Select, SelectOptions = typeof(UTorrentPriority), HelpText = "Priority to use when grabbing releases that aired within the last 14 days")]
public int RecentTvPriority { get; set; }
@@ -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 releases that aired over 14 days ago")]
public int OlderTvPriority { get; set; }
+ [FieldDefinition(7, Label = "Initial State", Type = FieldType.Select, SelectOptions = typeof(UTorrentState), HelpText = "Initial state for torrents added to uTorrent")]
+ public int IntialState { get; set; }
+
public NzbDroneValidationResult Validate()
{
return new NzbDroneValidationResult(Validator.Validate(this));
diff --git a/src/NzbDrone.Core/Download/Clients/uTorrent/UtorrentState.cs b/src/NzbDrone.Core/Download/Clients/uTorrent/UtorrentState.cs
new file mode 100644
index 000000000..17feaa485
--- /dev/null
+++ b/src/NzbDrone.Core/Download/Clients/uTorrent/UtorrentState.cs
@@ -0,0 +1,10 @@
+namespace NzbDrone.Core.Download.Clients.UTorrent
+{
+ public enum UTorrentState
+ {
+ Start = 0,
+ ForceStart = 1,
+ Pause = 2,
+ Stop = 3
+ }
+}
diff --git a/src/NzbDrone.Core/NzbDrone.Core.csproj b/src/NzbDrone.Core/NzbDrone.Core.csproj
index 8a05a0898..e85b02d56 100644
--- a/src/NzbDrone.Core/NzbDrone.Core.csproj
+++ b/src/NzbDrone.Core/NzbDrone.Core.csproj
@@ -556,6 +556,7 @@
+