@ -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 )
{
{