Merge pull request #565 from larsjohnsen/rtorrent-fixes

rTorrent: Update method names, enable compression on XMLRPC
pull/4/head
Taloth 10 years ago
commit 7a74327761

@ -23,25 +23,25 @@ namespace NzbDrone.Core.Download.Clients.RTorrent
public interface IRTorrent : IXmlRpcProxy public interface IRTorrent : IXmlRpcProxy
{ {
[XmlRpcMethod("d.multicall")] [XmlRpcMethod("d.multicall2")]
object[] TorrentMulticall(params string[] parameters); object[] TorrentMulticall(params string[] parameters);
[XmlRpcMethod("load_start")] [XmlRpcMethod("load.start")]
int LoadURL(string data); int LoadURL(string data);
[XmlRpcMethod("load_raw_start")] [XmlRpcMethod("load.raw_start")]
int LoadBinary(byte[] data); int LoadBinary(byte[] data);
[XmlRpcMethod("d.erase")] [XmlRpcMethod("d.erase")]
int Remove(string hash); int Remove(string hash);
[XmlRpcMethod("d.set_custom1")] [XmlRpcMethod("d.custom1.set")]
string SetLabel(string hash, string label); string SetLabel(string hash, string label);
[XmlRpcMethod("d.set_priority")] [XmlRpcMethod("d.priority.set")]
int SetPriority(string hash, long priority); int SetPriority(string hash, long priority);
[XmlRpcMethod("d.get_name")] [XmlRpcMethod("d.name")]
string GetName(string hash); string GetName(string hash);
[XmlRpcMethod("system.client_version")] [XmlRpcMethod("system.client_version")]
@ -70,21 +70,21 @@ namespace NzbDrone.Core.Download.Clients.RTorrent
public List<RTorrentTorrent> GetTorrents(RTorrentSettings settings) public List<RTorrentTorrent> GetTorrents(RTorrentSettings settings)
{ {
_logger.Debug("Executing remote method: d.multicall"); _logger.Debug("Executing remote method: d.multicall2");
var client = BuildClient(settings); var client = BuildClient(settings);
var ret = client.TorrentMulticall("main", var ret = client.TorrentMulticall("", "",
"d.get_name=", // string "d.name=", // string
"d.get_hash=", // string "d.hash=", // string
"d.get_base_path=", // string "d.base_path=", // string
"d.get_custom1=", // string (label) "d.custom1=", // string (label)
"d.get_size_bytes=", // long "d.size_bytes=", // long
"d.get_left_bytes=", // long "d.left_bytes=", // long
"d.get_down_rate=", // long (in bytes / s) "d.down.rate=", // long (in bytes / s)
"d.get_ratio=", // long "d.ratio=", // long
"d.is_open=", // long "d.is_open=", // long
"d.is_active=", // long "d.is_active=", // long
"d.get_complete="); //long "d.complete="); //long
var items = new List<RTorrentTorrent>(); var items = new List<RTorrentTorrent>();
foreach (object[] torrent in ret) foreach (object[] torrent in ret)
@ -110,7 +110,7 @@ namespace NzbDrone.Core.Download.Clients.RTorrent
public bool HasHashTorrent(string hash, RTorrentSettings settings) public bool HasHashTorrent(string hash, RTorrentSettings settings)
{ {
_logger.Debug("Executing remote method: d.get_name"); _logger.Debug("Executing remote method: d.name");
var client = BuildClient(settings); var client = BuildClient(settings);
@ -129,7 +129,7 @@ namespace NzbDrone.Core.Download.Clients.RTorrent
public void AddTorrentFromUrl(string torrentUrl, RTorrentSettings settings) public void AddTorrentFromUrl(string torrentUrl, RTorrentSettings settings)
{ {
_logger.Debug("Executing remote method: load_start"); _logger.Debug("Executing remote method: load.start");
var client = BuildClient(settings); var client = BuildClient(settings);
@ -142,7 +142,7 @@ namespace NzbDrone.Core.Download.Clients.RTorrent
public void AddTorrentFromFile(string fileName, Byte[] fileContent, RTorrentSettings settings) public void AddTorrentFromFile(string fileName, Byte[] fileContent, RTorrentSettings settings)
{ {
_logger.Debug("Executing remote method: load_raw_start"); _logger.Debug("Executing remote method: load.raw_start");
var client = BuildClient(settings); var client = BuildClient(settings);
@ -168,7 +168,7 @@ namespace NzbDrone.Core.Download.Clients.RTorrent
public void SetTorrentPriority(string hash, RTorrentSettings settings, RTorrentPriority priority) public void SetTorrentPriority(string hash, RTorrentSettings settings, RTorrentPriority priority)
{ {
_logger.Debug("Executing remote method: d.set_priority"); _logger.Debug("Executing remote method: d.priority.set");
var client = BuildClient(settings); var client = BuildClient(settings);
@ -203,6 +203,8 @@ namespace NzbDrone.Core.Download.Clients.RTorrent
var client = XmlRpcProxyGen.Create<IRTorrent>(); var client = XmlRpcProxyGen.Create<IRTorrent>();
client.Url = url; client.Url = url;
client.EnableCompression = true;
if (!settings.Username.IsNullOrWhiteSpace()) if (!settings.Username.IsNullOrWhiteSpace())
{ {
client.Credentials = new NetworkCredential(settings.Username, settings.Password); client.Credentials = new NetworkCredential(settings.Username, settings.Password);

Loading…
Cancel
Save