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
date_active
¶ the attribute “activityDate” as datetime.datetime.
-
property
date_added
¶ the attribute “addedDate” as datetime.datetime.
-
property
date_done
¶ the attribute “doneDate” as datetime.datetime. returns None if “doneDate” is invalid.
-
property
date_started
¶ the attribute “startDate” as datetime.datetime.
-
property
download_limit
¶ The download limit.
Can be a number or None.
-
property
eta
¶ the “eta” as datetime.timedelta.
-
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)
-
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
hashString
¶ Returns the info hash of this torrent.
Raise AttributeError if server don’t return this field
-
property
id
¶ Returns the id for this torrent
-
locate_data
(location: str, timeout: Optional[Union[int, float, Tuple[Union[int, float], Union[int, float]]]] = None) → None[source]¶ Locate torrent data at location.
-
move_data
(location: str, timeout: Optional[Union[int, float, Tuple[Union[int, float], Union[int, float]]]] = None) → None[source]¶ Move torrent data to location.
-
property
name
¶ Returns the name of this torrent.
Raise AttributeError if server don’t return this field
-
property
peer_limit
¶ the peer limit.
-
property
priority
¶ Bandwidth priority as string. Can be one of ‘low’, ‘normal’, ‘high’. This is a mutator.
-
property
progress
¶ download progress in percent.
-
property
queue_position
¶ queue position for this torrent.
-
property
rateDownload
¶ Returns download rate in B/s
-
property
rateUpload
¶ Returns upload rate in B/s
-
property
ratio
¶ upload/download ratio.
-
property
seed_idle_limit
¶ seed idle limit in minutes.
-
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.
-
start
(bypass_queue: bool = False, timeout: Optional[Union[int, float, Tuple[Union[int, float], Union[int, float]]]] = None) → None[source]¶ Start the torrent.
-
property
status
¶ Returns the torrent status. Is either one of ‘check pending’, ‘checking’, ‘downloading’, ‘seeding’ or ‘stopped’. The first two is related to verification.
-
stop
(timeout: Optional[Union[int, float, Tuple[Union[int, float], Union[int, float]]]] = None) → None[source]¶ Stop the torrent.
-
update
(timeout: Optional[Union[int, float, Tuple[Union[int, float], Union[int, float]]]] = None) → None[source]¶ Update the torrent information.
-
property
upload_limit
¶ upload limit. Can be a number or None.
-
property