Net::RTorrent - Perl interface to rtorrent via XML-RPC.
#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 );
Perl interface to rtorrent via XML-RPC
Net::RTorrent - short way to create tools for rtorrent.
Creates a new client object that will route its requests to the URL provided.
Load torrent from file descriptor or scalar ref.
Params:
1 - start download now (default)
0 - not start download
For read tag value use:
$ditem->tag
Call d.erase on info_hashes.
return { <info_hashes> => <xml-rpc response value> }
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'
Return collection of downloads (" Net::RTorrent::Downloads").
To get list of view:
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 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' ] ];
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:
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"
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
Net::RTorrent::DItem, Net::RTorrent::Downloads, http://libtorrent.rakshasa.no/wiki/RTorrentXMLRPCGuide
Zahatski Aliaksandr, <zag@cpan.org>
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:
L<> starts or ends with whitespace
To install Net::RTorrent, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::RTorrent
CPAN shell
perl -MCPAN -e shell install Net::RTorrent
For more information on module installation, please visit the detailed CPAN module installation guide.