Transm...Client(3pm)

πŸ“¦
version 0.0806 Β· 3 versions
, in ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– 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 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 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.1
  • delete_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.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. 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 the verify signature. 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 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