Transm...Client(3pm)
π Transmission::Client (3pm) π
okay so bestie, gather round, because this is the manual page for Transmission::Client β straight outta the User Contributed Perl Documentation, and she's serving immaculate group-chat energy. We're at version 0.0806 and yes, we're obsessed. π
β¨ NAME β¨
Transmission::Client β your lil interface to Transmission π«Ά
π VERSION π
0.0806 β¨
π DESCRIPTION π
So Transmission::Client is the main module in a whole collection of modules that talk to Transmission. And what is Transmission, you ask? It's a cross-platform BitTorrent client that is, and I quote:
- Easy π
- Lean π
- Native π±
- Powerful πͺ
- Free π
If your goal in life is to communicate with transmission-daemon, then bestie, this is the module for you. It can help you with that. No cap.
Heads up though: the documentation is half copy/paste from the Transmission RPC spec: https://trac.transmissionbt.com/browser/trunk/extras/rpc-spec.txt β iykyk.
And here's how this module differs from P2P::Transmission, in (at least) two ways: this one uses Moose, and it won't die. The dying thing is especially annoying, lowkey, especially in the constructor. π
π¦ SYNOPSIS π¦
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";
π FAULT HANDLING π
In 0.06, Transmission::Client can be constructed with autodie set to true, which makes this object confess instead of just quietly setting error. Dramatic? Yes. Useful? Also yes.
Example:
my $client = Transmission::Client->new(autodie => 1);
eval {
$self->add(filename => 'foo.torrent');
} or do {
# add() failed...
};
π SEE ALSO π
Transmission::AttributeRole Β· Transmission::Session Β· Transmission::Torrent Β· Transmission::Utils
π₯ ATTRIBUTES π₯
π url
$str = $self->url;
Returns an URL pointing at wherever the Transmission rpc api lives. The default value is "http://localhost:9091/transmission/rpc" β¨
π error
$str = $self->error;
Returns the last error known to the object. All methods can return an empty list on top of whatever else they're specified to return β so if that ever happens to you, check this attribute. π
You like autodie? Then create your object with autodie set to true and this module will throw exceptions in addition to setting this variable. Double the drama, double the info. π
π username
$str = $self->username;
Used to authenticate against Transmission.
π€« password
$str = $self->password;
Used to authenticate against Transmission. (Shhh. Don't tell anyone.)
β±οΈ timeout
$int = $self->timeout;
Number of seconds to wait for the RPC response. Patience is a virtue, bestie.
π§ session
$session_obj = $self->session;
$stats_obj = $self->stats;
Returns an instance of Transmission::Session. And plot twist: stats() is a proxy method on session. π
π torrents
$array_ref = $self->torrents;
$self->clear_torrents;
Returns an array-ref of Transmission::Torrent objects. The default value is a full list of all known torrents, with as little data as possible read from Transmission. Which means β and this is the important part β every single request for an attribute on an object will require a new request back to Transmission. See read_torrents for more info, fr fr.
β version
$str = $self->version;
Get the Transmission version.
π« session_id
$self->session_id($str);
$str = $self->session_id;
The session ID used to communicate with Transmission.
πΈ METHODS πΈ
β add
$bool = $self->add(%args);
The args are giving:
download_dir(string) β path to download the torrent tofilename(string) β filename or URL of the.torrentfilemetainfo(string) β torrent contentpaused(boolean) β if true, don't start the torrentpeer_limit(number) β maximum number of peers
EitherfilenameormetainfoMUST be included. All the other arguments are optional. π
See "3.4 Adding a torrent" from https://trac.transmissionbt.com/browser/trunk/extras/rpc-spec.txt
β remove
$bool = $self->remove(%args);
ids(array) β torrent list, as described in 3.1delete_local_data(boolean) β delete local data. (default:false)
ids can also be the string all. And ids is required, bestie β you can't just vibe your way out of that one.
See "3.4 Removing a torrent" from https://trac.transmissionbt.com/browser/trunk/extras/rpc-spec.txt
π¦ move
$bool = $self->move(%args);
ids(array) β torrent list, as described in 3.1location(string) β the new torrent locationmove(boolean) β if true, move from previous location. otherwise, searchlocationfor files
ids can also be the string all. And ids and location is required.
See "3.5 moving a torrent" from https://trac.transmissionbt.com/browser/trunk/extras/rpc-spec.txt
βΆοΈ start
$bool = $self->start($ids);
Will start one or more torrents. And $ids? It can be a single int, an array of ints, or the string all. Flexible queen. π
βΉοΈ stop
$bool = $self->stop($ids);
Will stop one or more torrents. $ids can be a single int, an array of ints, or the string all.
β verify
$bool = $self->stop($ids);
Will verify one or more torrents. $ids can be a single int, an array of ints, or the string all.
yes, the docs literally show$self->stop($ids)in theverifysignature. we are copying it exactly, character for character, because that is the rule π no editing, only love.
π read_torrents
@list = $self->read_torrents(%args);
$array_ref = $self->read_torrents(%args);
ids(array) β optional torrent list, as described in 3.1.lazy_readβ will create objects with as little data as possible.
List context
Returns a list of Transmission::Torrent objects and sets the torrents attribute.
Scalar context
Returns an array-ref of Transmission::Torrent.
π‘ rpc
$any = $self->rpc($method, %args);
Communicate with the backend. This method is meant for internal use β like, stay out of its lane, bestie.
π read_all
1 == $self->read_all;
This method will try to populate ALL torrent, session and stats information, and it does it using three requests. Efficiency? We love to see it. β¨
β LICENSE β
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. π«Ά
π COPYRIGHT AND AUTHORS π
Copyright 2009-2019 by Transmission::Client contributors.
See the following in the git repository for the reference list of contributors:
git log --format="%aN <%aE>" | sort | uniq
πΈ CONTRIBUTORS
- Jan Henning Thorsen (original author)
- Olof Johansson (current maintainer)
- Andrew Fresh
- Yanick Champoux
and that's the whole page, bestie π this was perl v5.36.0, dated 2022-10-16, from the Transmission::Client manual β slay, periodt πβ¨π¦
π¦ where this page comes from
- ubuntu noble: libtransmission-client-perl 0.0806-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libtransmission-client-perl 0.0806-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libtransmission-client-perl 0.0806-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms