RTPG - is a module for accessing to rtorrent's SCGI functions.
0.3
use RTPG; # standard variant my $h = new RTPG(url=>'http://localhost/RPC2'); # direct connection to rtorrent my $h = new RTPG(url=>'localhost:5000'); my $h = new RTPG(url=>'/path/to/socket.rtorrent'); die $! unless defined $h; # arrayref and error (standard version) my ($tlist, $error)=$h->torrents_list; # arrayref (died version) my $tlist=$h->torrents_list; for (@$tlist) { my $file_list=$h->file_list($_->{hash}); .. } # direct commands by RPC my $list_methods=$h->rpc_command('system.listMethods'); my ($list_methods, $error)=$h->rpc_command('system.listMethods'); # system information (library versions, etc) my $hashref=$h->system_information; my ($hashref, $error)=$h->system_information;
The constructor. It receives the next options:
is an address of rtorrent's SCGI (direct) or rtorrent's RPC (standard).
You can use this method for send commands to rtorrent.
# standard version my ($result, $error)=$h->rpc_command('system.listMethods'); # died version my $result=$h->rpc_command('system.listMethods');
This method returns list of torrents. It is a link to array of hashes.
# standard version my ($tlist, $err)=$h->torrents_list; my ($tlist, $err)=$h->torrents_list('started');
# died version my $tlist=$h->torrents_list; my $tlist=$h->torrents_list('started');
The method returns the link to hash which contains the information about the torrent (tid);
my $tlist = $h->torrents_list; my $tinfo_first = $tlist->[0]; my $tinfo_first_second_time = $h->torrent_info($tlist->[0]{hash});
Hashes $tinfo_first and $tinfo_first_second_time are equal. This method can use if You know torrent-id and do not know an other information about the torrent.
# standard version my ($tinfo, $error)=$h->torrent_info($tid); # died version my $tinfo=$h->torrent_info($tid);
The method returns the link to array which contains information about each file that belong to the torrent (tid).
# standard version my ($files, $error)=$h->file_list($tid); # died version my $files=$h->file_list($tid);
This method updates priorities of all files in one torrent
# standard version my $error=$h->set_files_priorities($tid, $pri); my ($error)=$h->set_files_priorities($tid, $pri); # died version $h->set_files_priorities($tid, $pri);
The method returns the link to hash about system information. The hash has the fields:
the version of rtorrent.
the version of librtorrent.
returns list of rtorrent commands
counts percent by pair values
converts big numbers to small 1024 = 1K, 1024**2 == 1M, etc
percents, ratio, human_size, human_done, human_up_total, human_up_rate, human_down_rate
32bit overflow in libxmlrpc-c3 version < 1.07
Copyright (C) 2008 Dmitry E. Oboukhov <unera@debian.org>,
Copyright (C) 2008 Nikolaev Roman <rshadow@rambler.ru>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
To install RTPG, copy and paste the appropriate command in to your terminal.
cpanm
cpanm RTPG
CPAN shell
perl -MCPAN -e shell install RTPG
For more information on module installation, please visit the detailed CPAN module installation guide.