RTPG - is a module for accessing to rtorrent's SCGI functions.
0.92
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'); # 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).
if TRUE, commands will process in queue mode (use flock).
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);
The method returns information about trackers.
The method returns information about peers we are connected (by torrent id).
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);
Set file priority
The method returns the link to hash about system information. The hash has the fields:
the version of rtorrent.
the version of librtorrent.
The method returns information about views in rtorrent. There are a few additional named arguments:
if TRUE, method will return additional information about view.
Start torrent (tid) download
Stop torrent (tid) download
Delete torrent (tid)
Pause torrent (tid)
Check torrent hash (tid)
Set torrent priority (tid, priority)
Set maximum download rate for all torrents
Set maximum upload rate for all torrents
Return varios current speed rates and etc.
Add new torrent for download from url list or filehandle
returns list of rtorrent commands
counts percent by pair values
percents, ratio, human_size, human_done, human_up_total, human_up_rate, human_down_rate
32bit overflow in libxmlrpc-c3 version < 1.07
converts big numbers to small 1024 = 1K, 1024**2 == 1M, etc
As as_human_size, but convert into speed
Return datetime string from timestemp
Convert torrent priority name to int
Convert file priority name to int
Copyright (C) 2008 Dmitry E. Oboukhov <unera@debian.org>,
Copyright (C) 2008 Roman V. Nikolaev <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.