@ -95,32 +95,32 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -95,32 +95,32 @@ public class RtorrentAdapter implements IDaemonAdapter {
case Retrieve :
// @formatter:off
Object result = makeRtorrentCall ( log , "d.multicall" ,
new String [ ] { "main" ,
"d.get_ hash=" ,
"d.get_ name=" ,
"d.get_ state=" ,
"d.get_down_rate=" ,
"d.get_up_rate=" ,
"d.get_ peers_connected=" ,
"d.get_ peers_not_connected=" ,
"d.get_ peers_accounted=" ,
"d.get_ bytes_done=" ,
"d.get_up_ total=" ,
"d.get_ size_bytes=" ,
"d.get_ creation_date=" ,
"d.get_ left_bytes=" ,
"d.get_ complete=" ,
Object result = makeRtorrentCall ( log , "d.multicall2 " ,
new String [ ] { "" , " main" ,
"d.hash=" ,
"d.name=" ,
"d.state=" ,
"d.down.rate=" ,
"d.up.rate=" ,
"d.peers_connected=" ,
"d.peers_not_connected=" ,
"d.peers_accounted=" ,
"d.bytes_done=" ,
"d.up. total=" ,
"d.size_bytes=" ,
"d.creation_date=" ,
"d.left_bytes=" ,
"d.complete=" ,
"d.is_active=" ,
"d.is_hash_checking=" ,
"d.get_ base_path=" ,
"d.get_ base_filename=" ,
"d.get_ message=" ,
"d.get_ custom=addtime" ,
"d.get_ custom=seedingtime" ,
"d.get_ custom1=" ,
"d.get_ peers_complete=" ,
"d.get_ peers_accounted=" } ) ;
"d.base_path=" ,
"d.base_filename=" ,
"d.message=" ,
"d.custom=addtime" ,
"d.custom=seedingtime" ,
"d.custom1=" ,
"d.peers_complete=" ,
"d.peers_accounted=" } ) ;
// @formatter:on
return new RetrieveTaskSuccessResult ( ( RetrieveTask ) task , onTorrentsRetrieved ( result ) ,
lastKnownLabels ) ;
@ -131,7 +131,7 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -131,7 +131,7 @@ public class RtorrentAdapter implements IDaemonAdapter {
Object dresult = makeRtorrentCall ( log , "t.multicall" , new String [ ] {
task . getTargetTorrent ( ) . getUniqueID ( ) ,
"" ,
"t.get_ url=" } ) ;
"t.url=" } ) ;
// @formatter:on
return new GetTorrentDetailsTaskSuccessResult ( ( GetTorrentDetailsTask ) task ,
onTorrentDetailsRetrieved ( log , dresult ) ) ;
@ -142,13 +142,13 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -142,13 +142,13 @@ public class RtorrentAdapter implements IDaemonAdapter {
Object fresult = makeRtorrentCall ( log , "f.multicall" , new String [ ] {
task . getTargetTorrent ( ) . getUniqueID ( ) ,
"" ,
"f.get_ path=" ,
"f.get_ size_bytes=" ,
"f.get_ priority=" ,
"f.get_ completed_chunks=" ,
"f.get_ size_chunks=" ,
"f.get_ priority=" ,
"f.get_ frozen_path=" } ) ;
"f.path=" ,
"f.size_bytes=" ,
"f.priority=" ,
"f.completed_chunks=" ,
"f.size_chunks=" ,
"f.priority=" ,
"f.frozen_path=" } ) ;
// @formatter:on
return new GetFileListTaskSuccessResult ( ( GetFileListTask ) task ,
onTorrentFilesRetrieved ( fresult , task . getTargetTorrent ( ) ) ) ;
@ -167,22 +167,22 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -167,22 +167,22 @@ public class RtorrentAdapter implements IDaemonAdapter {
byte [ ] bytes = baos . toByteArray ( ) ;
int size = ( int ) file . length ( ) * 2 ;
final int XMLRPC_EXTRA_PADDING = 1280 ;
makeRtorrentCall ( log , "set_xmlrpc_size_limi t" , new Object [ ] { size + XMLRPC_EXTRA_PADDING } ) ;
makeRtorrentCall ( log , "load_ raw_start" , new Object [ ] { bytes } ) ;
makeRtorrentCall ( log , "network.xmlrpc.size_limit.se t" , new Object [ ] { size + XMLRPC_EXTRA_PADDING } ) ;
makeRtorrentCall ( log , "load. raw_start" , new Object [ ] { bytes } ) ;
return new DaemonTaskSuccessResult ( task ) ;
case AddByUrl :
// Request to add a torrent by URL
String url = ( ( AddByUrlTask ) task ) . getUrl ( ) ;
makeRtorrentCall ( log , "load_ start" , new String [ ] { url } ) ;
makeRtorrentCall ( log , "load. start" , new String [ ] { "" , url } ) ;
return new DaemonTaskSuccessResult ( task ) ;
case AddByMagnetUrl :
// Request to add a magnet link by URL
String magnet = ( ( AddByMagnetUrlTask ) task ) . getUrl ( ) ;
makeRtorrentCall ( log , "load_ start" , new String [ ] { magnet } ) ;
makeRtorrentCall ( log , "load. start" , new String [ ] { "" , magnet } ) ;
return new DaemonTaskSuccessResult ( task ) ;
case Remove :
@ -190,7 +190,7 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -190,7 +190,7 @@ public class RtorrentAdapter implements IDaemonAdapter {
// Remove a torrent
RemoveTask removeTask = ( RemoveTask ) task ;
if ( removeTask . includingData ( ) ) {
makeRtorrentCall ( log , "d.set_ custom5" ,
makeRtorrentCall ( log , "d.custom5.set " ,
new String [ ] { task . getTargetTorrent ( ) . getUniqueID ( ) , "1" } ) ;
}
makeRtorrentCall ( log , "d.erase" , new String [ ] { task . getTargetTorrent ( ) . getUniqueID ( ) } ) ;
@ -205,7 +205,7 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -205,7 +205,7 @@ public class RtorrentAdapter implements IDaemonAdapter {
case PauseAll :
// Resume all torrents
makeRtorrentCall ( log , "d.multicall" , new String [ ] { "main" , "d.pause=" } ) ;
makeRtorrentCall ( log , "d.multicall2 " , new String [ ] { "" , "main" , "d.pause=" } ) ;
return new DaemonTaskSuccessResult ( task ) ;
case Resume :
@ -217,7 +217,7 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -217,7 +217,7 @@ public class RtorrentAdapter implements IDaemonAdapter {
case ResumeAll :
// Resume all torrents
makeRtorrentCall ( log , "d.multicall" , new String [ ] { "main" , "d.resume=" } ) ;
makeRtorrentCall ( log , "d.multicall2 " , new String [ ] { "" , "main" , "d.resume=" } ) ;
return new DaemonTaskSuccessResult ( task ) ;
case Stop :
@ -229,7 +229,7 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -229,7 +229,7 @@ public class RtorrentAdapter implements IDaemonAdapter {
case StopAll :
// Stop all torrents
makeRtorrentCall ( log , "d.multicall" , new String [ ] { "main" , "d.stop=" } ) ;
makeRtorrentCall ( log , "d.multicall2 " , new String [ ] { "" , "main" , "d.stop=" } ) ;
return new DaemonTaskSuccessResult ( task ) ;
case Start :
@ -241,7 +241,7 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -241,7 +241,7 @@ public class RtorrentAdapter implements IDaemonAdapter {
case StartAll :
// Start all torrents
makeRtorrentCall ( log , "d.multicall" , new String [ ] { "main" , "d.start=" } ) ;
makeRtorrentCall ( log , "d.multicall2 " , new String [ ] { "" , "main" , "d.start=" } ) ;
return new DaemonTaskSuccessResult ( task ) ;
case SetFilePriorities :
@ -251,7 +251,7 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -251,7 +251,7 @@ public class RtorrentAdapter implements IDaemonAdapter {
String newPriority = "" + convertPriority ( prioTask . getNewPriority ( ) ) ;
// One at a time; rTorrent doesn't seem to support a multicall on a selective number of files
for ( TorrentFile forFile : prioTask . getForFiles ( ) ) {
makeRtorrentCall ( log , "f.set_ priority" ,
makeRtorrentCall ( log , "f.priority.set " ,
new String [ ] { task . getTargetTorrent ( ) . getUniqueID ( ) + ":f" + forFile . getKey ( ) ,
newPriority } ) ;
}
@ -261,16 +261,16 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -261,16 +261,16 @@ public class RtorrentAdapter implements IDaemonAdapter {
// Request to set the maximum transfer rates
SetTransferRatesTask ratesTask = ( SetTransferRatesTask ) task ;
makeRtorrentCall ( log , "set_download_rate " , new String [ ] { ( ratesTask . getDownloadRate ( ) = = null ? "0" :
makeRtorrentCall ( log , "throttle.global_down.max_rate.set " , new String [ ] { "" , ( ratesTask . getDownloadRate ( ) = = null ? "0" :
ratesTask . getDownloadRate ( ) . toString ( ) + "k" ) } ) ;
makeRtorrentCall ( log , "set_upload_rate " , new String [ ] {
makeRtorrentCall ( log , "throttle.global_up.max_rate.set " , new String [ ] { "" ,
( ratesTask . getUploadRate ( ) = = null ? "0" : ratesTask . getUploadRate ( ) . toString ( ) + "k" ) } ) ;
return new DaemonTaskSuccessResult ( task ) ;
case SetLabel :
SetLabelTask labelTask = ( SetLabelTask ) task ;
makeRtorrentCall ( log , "d.set_ custom1" ,
makeRtorrentCall ( log , "d.custom1.set " ,
new String [ ] { task . getTargetTorrent ( ) . getUniqueID ( ) , labelTask . getNewLabel ( ) } ) ;
return new DaemonTaskSuccessResult ( task ) ;