Transmission::Client(3pm) | User Contributed Perl Documentation | Transmission::Client(3pm) |
Transmission::Client - Interface to Transmission
0.0805
Transmission::Client is the main module in a collection of modules to communicate with Transmission. Transmission is:
Transmission is a cross-platform BitTorrent client that is: * Easy * Lean * Native * Powerful * Free
If you want to communicate with "transmission-daemon", this is a module which can help you with that.
The documentation is half copy/paste from the Transmission RPC spec: <https://trac.transmissionbt.com/browser/trunk/extras/rpc-spec.txt>
This module differs from P2P::Transmission in (at least) two ways: This one use Moose and it won't die. The latter is especially annoying in the constructor.
use Transmission::Client; my $client = Transmission::Client->new; my $torrent_id = 2; my $data = base64_encoded_data(); $client->add(metainfo => $data) or confess $client->error; $client->remove($torrent_id) or confess $client->error; for my $torrent (@{ $client->torrents }) { print $torrent->name, "\n"; for my $file (@{ $torrent->files }) { print "> ", $file->name, "\n"; } } print $client->session->download_dir, "\n";
In 0.06 Transmission::Client can be constructed with "autodie" set to true, to make this object confess instead of just setting "error". Example:
my $client = Transmission::Client->new(autodie => 1); eval { $self->add(filename => 'foo.torrent'); } or do { # add() failed... };
Transmission::AttributeRole Transmission::Session Transmission::Torrent Transmission::Utils
$str = $self->url;
Returns an URL to where the Transmission rpc api is. Default value is "http://localhost:9091/transmission/rpc";
$str = $self->error;
Returns the last error known to the object. All methods can return empty list in addition to what specified. Check this attribute if so happens.
Like "autodie"? Create your object with "autodie" set to true and this module will throw exceptions in addition to setting this variable.
$str = $self->username;
Used to authenticate against Transmission.
$str = $self->password;
Used to authenticate against Transmission.
$int = $self->timeout;
Number of seconds to wait for RPC response.
$session_obj = $self->session; $stats_obj = $self->stats;
Returns an instance of Transmission::Session. "stats()" is a proxy method on "session".
$array_ref = $self->torrents; $self->clear_torrents;
Returns an array-ref of Transmission::Torrent objects. Default value is a full list of all known torrents, with as little data as possible read from Transmission. This means that each request on a attribute on an object will require a new request to Transmission. See "read_torrents" for more information.
$str = $self->version;
Get Transmission version.
$self->session_id($str); $str = $self->session_id;
The session ID used to communicate with Transmission.
$bool = $self->add(%args); key | value type & description -----------------+------------------------------------------------- download_dir | string path to download the torrent to filename | string filename or URL of the .torrent file metainfo | string torrent content paused | boolean if true, don't start the torrent peer_limit | number maximum number of peers
Either "filename" or "metainfo" MUST be included. All other arguments are optional.
See "3.4 Adding a torrent" from <https://trac.transmissionbt.com/browser/trunk/extras/rpc-spec.txt>
$bool = $self->remove(%args); key | value type & description -------------------+------------------------------------------------- ids | array torrent list, as described in 3.1 delete_local_data | boolean delete local data. (default: false)
"ids" can also be the string "all". "ids" is required.
See "3.4 Removing a torrent" from <https://trac.transmissionbt.com/browser/trunk/extras/rpc-spec.txt>
$bool = $self->move(%args); string | value type & description ------------+------------------------------------------------- ids | array torrent list, as described in 3.1 location | string the new torrent location move | boolean if true, move from previous location. | otherwise, search "location" for files
"ids" can also be the string "all". "ids" and "location" is required.
See "3.5 moving a torrent" from <https://trac.transmissionbt.com/browser/trunk/extras/rpc-spec.txt>
$bool = $self->start($ids);
Will start one or more torrents. $ids can be a single int, an array of ints or the string "all".
$bool = $self->stop($ids);
Will stop one or more torrents. $ids can be a single int, an array of ints or the string "all".
$bool = $self->stop($ids);
Will verify one or more torrents. $ids can be a single int, an array of ints or the string "all".
@list = $self->read_torrents(%args); $array_ref = $self->read_torrents(%args); key | value type & description ------------+------------------------------------------------- ids | array torrent list, as described in 3.1 | this is optional lazy_read | will create objects with as little data as possible.
$any = $self->rpc($method, %args);
Communicate with backend. This methods is meant for internal use.
1 == $self->read_all;
This method will try to populate ALL torrent, session and stats information, using three requests.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Copyright 2009-2013, Jan Henning Thorsen <jhthorsen@cpan.org> and contributors
Current maintainer: Olof Johansson - "olof@cpan.org"
2016-08-02 | perl v5.22.2 |