Torrent

class transmission_rpc.torrent.Torrent(client: Client, fields: Dict[str, Any])[source]

Torrent is a class holding the data received from Transmission regarding a bittorrent transfer.

All fetched torrent fields are accessible through this class using attributes. This class has a few convenience properties using the torrent data.

property id

Returns the id for this torrent

files()List[transmission_rpc.lib_types.File][source]

Get list of files for this torrent.

Note

The order of the files is guaranteed. The index of file object is the id of the file when calling transmission_rpc.client.Client.set_files().

from transmission_rpc import Client

torrent = Client().get_torrent(0)

for file_id, file in enumerate(torrent.files()):
    print(file_id, file)
property name

Returns the name of this torrent.

Raise AttributeError if server don’t return this field

property status

Returns the torrent status. Is either one of ‘check pending’, ‘checking’, ‘downloading’, ‘seeding’ or ‘stopped’. The first two is related to verification.

property rateDownload

Returns download rate in B/s

property rateUpload

Returns upload rate in B/s

property hashString

Returns the info hash of this torrent.

Raise AttributeError if server don’t return this field

property progress

download progress in percent.

property ratio

upload/download ratio.

property eta

the “eta” as datetime.timedelta.

property date_active

the attribute “activityDate” as datetime.datetime.

property date_added

the attribute “addedDate” as datetime.datetime.

property date_started

the attribute “startDate” as datetime.datetime.

property date_done

the attribute “doneDate” as datetime.datetime. returns None if “doneDate” is invalid.

format_eta()str[source]

Returns the attribute eta formatted as a string.

  • If eta is -1 the result is ‘not available’

  • If eta is -2 the result is ‘unknown’

  • Otherwise eta is formatted as <days> <hours>:<minutes>:<seconds>.

property download_limit

The download limit.

Can be a number or None.

property peer_limit

the peer limit.

property priority

Bandwidth priority as string. Can be one of ‘low’, ‘normal’, ‘high’. This is a mutator.

property seed_idle_limit

seed idle limit in minutes.

property is_finished

Returns true if the torrent is finished (available from rpc version 2.0)

property is_stalled

Returns true if the torrent is stalled (available from rpc version 2.4)

property size_when_done

Size in bytes when the torrent is done

property total_size

Total size in bytes

property left_until_done

Bytes left until done

property desired_available

Bytes that are left to download and available

property available

Availability in percent

property seed_idle_mode

Seed idle mode as string. Can be one of ‘global’, ‘single’ or ‘unlimited’.

  • global, use session seed idle limit.

  • single, use torrent seed idle limit. See seed_idle_limit.

  • unlimited, no seed idle limit.

property seed_ratio_limit

Torrent seed ratio limit as float. Also see seed_ratio_mode. This is a mutator.

property seed_ratio_mode

Seed ratio mode as string. Can be one of ‘global’, ‘single’ or ‘unlimited’.

  • global, use session seed ratio limit.

  • single, use torrent seed ratio limit. See seed_ratio_limit.

  • unlimited, no seed ratio limit.

This is a mutator.

property upload_limit

upload limit. Can be a number or None.

property queue_position

queue position for this torrent.

update(timeout: Optional[Union[int, float, Tuple[Union[int, float], Union[int, float]]]] = None)None[source]

Update the torrent information.

start(bypass_queue: bool = False, timeout: Optional[Union[int, float, Tuple[Union[int, float], Union[int, float]]]] = None)None[source]

Start the torrent.

stop(timeout: Optional[Union[int, float, Tuple[Union[int, float], Union[int, float]]]] = None)None[source]

Stop the torrent.

move_data(location: str, timeout: Optional[Union[int, float, Tuple[Union[int, float], Union[int, float]]]] = None)None[source]

Move torrent data to location.

locate_data(location: str, timeout: Optional[Union[int, float, Tuple[Union[int, float], Union[int, float]]]] = None)None[source]

Locate torrent data at location.