NAME
Net::RTorrent - Perl interface to rtorrent via XML-RPC.
SYNOPSIS
#from http scgi gate
my $obj = new Net::RTorrent:: 'http://10.100.0.1:8080/scgitest';
#from network address
my $obj = new Net::RTorrent:: '10.100.0.1:5000';
#from UNIX socket
my $obj = new Net::RTorrent:: '/tmp/rtorrent.sock';
#get completed torrents list
my $dloads = $obj->get_downloads('complete');
#get all torrents list
my $dloads = $obj->get_downloads();
#get stopped torrents list
my $dloads = $obj->get_downloads('stopped');
#fetch all items
$dloads->fetch()
#or by hash_info
$dloads->fetch_one('02DE69B09364A355F71279FC8825ADB0AC8C3A29')
#list oll hash_info
my $keys = $dloads->list_ids;
#upload remotely
$obj->create( $torrent_raw );
$obj->create( $data, 0 );
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.
create \$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
delete (<info_hash1>[, <info_hash2> ... ])
Call d.erase on info_hashes.
return { <info_hashes> => <xml-rpc response value> }
list_ids ( [ <name of view> ])
Return list of rtorrent info_hashes for name of view. An empty string for name of view equals "default".
To get list of views names :
xmlrpc http://10.100.0.1:8080/scgitest view_list
'main'
'default'
'name'
'started'
'stopped'
'complete'
'incomplete'
'hashing'
'seeding'
'scheduler'
get_downloads [ <view name > || 'default']
Return collection of downloads (" Net::RTorrent::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'
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'
};
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-2009 by Zahatski Aliaksandr
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 210:
L<> starts or ends with whitespace