NAME
Net::RTorrent - Perl interface to rtorrent via XML-RPC.
SYNOPSIS
my $obj = new Net::RTorrent:: 'http://10.100.0.1:8080/scgitest';
my $dloads = $obj->get_downloads;
my $keys = $dloads->list_ids;
$obj->load_raw( $torrent_raw );
ABSTRACT
Perl interface to rtorrent via XML-RPC
DESCRIPTION
Net::RTorrent - short way to create tools for rtorrent.
METHODS
new URL
Creates a new client object that will route its requests to the URL provided.
get_downloads [ <view name > || 'default']
Return collection of downloads
To get list of view:
xmlrpc http://10.100.0.1:8080/scgitest view_list
'main'
'default'
'name'
'started'
'stopped'
'complete'
'incomplete'
'hashing'
'seeding'
'scheduler'
load_raw [\$raw_data || new IO::File ], [ start_now=>1||0 , tag=><string>]
load torrent from file descriptor or scalar ref.
Params:
- start_now - start torent now
-
1 - start download now (default)
0 - not start download
- tag - save <string> to rtorrent
-
For read tag value use:
$ditem->tag
system_stat
Return system stat.
For example:
print Dumper $obj->system_stat;
Return:
{
'library_version' => '0.11.9',
'max_memory_usage' => '-858993460', # at my amd64 ??
'upload_rate' => '0',
'name' => 'gate.home.zg:1378',
'memory_usage' => '115867648',
'download_rate' => '0',
'hostname' => 'gate.home.zg',
'pid' => '1378',
'client_version' => '0.7.9',
'safe_free_diskspace' => '652738560'
};
remove_untied (TODO)
remove_untied
do_sys_mutlicall 'method1' =>[ <param1>, .. ], ...
Do XML::RPC system.multicall. Return ref to ARRAY of results
For sample.
print Dumper $obj->do_sys_mutlicall('system.pid'=>[], 'system.hostname'=>[]);
Will return:
[
[
'1378'
],
[
'gate.home.zg'
]
];
Setting up rtorrent
If you are compiling from rtorrent's source code, this is done during the configuration step by adding the flag --with-xmlrpc-c to the configure step. Example ./configure --with-xmlrpc-c. See http://libtorrent.rakshasa.no/wiki/RTorrentXMLRPCGuide
Setup your rtorrent and Web server. My tips:
.rtorrent
scgi_port = 10.100.0.1:5000
#for complete erase
on_erase = erase_complete,"execute=rm,-rf,$d.get_base_path="
#or for save backup
on_erase = move_complete,"execute=mv,-n,$d.get_base_path=,~/erased/ ;d.set_directory=~/erased"
apache.conf
LoadModule scgi_module libexec/apache2/mod_scgi.so
<IfModule mod_scgi.c>
SCGIMount /scgitest 10.100.0.1:5000
<Location "/scgitest">
SCGIHandler On
</Location>
</IfModule>
My url for XML::RPC is http://10.100.0.1:8080/scgitest.
Use xmlrpc ( http://xmlrpc-c.sourceforge.net/ ) for tests:
xmlrpc http://10.100.0.1:8080/scgitest system.listMethods
SEE ALSO
Net::RTorrent::DItem, Net::RTorrent::Downloads, http://libtorrent.rakshasa.no/wiki/RTorrentXMLRPCGuide
AUTHOR
Zahatski Aliaksandr, <zag@cpan.org>
COPYRIGHT AND LICENSE
Copyright 2008 by Zahatski Aliaksandr
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.