Torrent
- class transmission_rpc.torrent.Torrent[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: int
Returns the id for this torrent
- files()[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)
- Return type
List[transmission_rpc.lib_types.File]
- property name: str
Returns the name of this torrent.
Raise AttributeError if server don’t return this field
- property status: transmission_rpc.torrent.Status
- Return type
Returns the torrent status. Is either one of ‘check pending’, ‘checking’, ‘downloading’, ‘download pending’, ‘seeding’, ‘seed pending’ or ‘stopped’. The first two is related to verification.
Examples:
torrent = Torrent() torrent.status.downloading torrent.status == 'downloading'
- property rateDownload: int
Returns download rate in B/s
- Return type
int
- property rateUpload: int
Returns upload rate in B/s
- Return type
int
- property hashString: str
Returns the info hash of this torrent.
- Raise
AttributeError – if server don’t return this field
- property progress: float
download progress in percent.
- Return type
float
- property ratio: float
upload/download ratio.
- Return type
float
- property eta: datetime.timedelta
the “eta” as datetime.timedelta.
If downloading, estimated the
timedelta
left until the torrent is done. If seeding, estimated thetimedelta
left until seed ratio is reached.raw eta maybe negative: - -1 for ETA Not Available. - -2 for ETA Unknown.
https://github.com/transmission/transmission/blob/3.00/libtransmission/transmission.h#L1748-L1749
- Return type
datetime.timedelta
- Raises
ValueError – non positive ETA.
- property date_active: datetime.datetime
the attribute
activityDate
asdatetime.datetime
in UTC timezone.Note
raw
activityDate
value could be0
for never activated torrent, therefore it can’t always be converted to local timezone.- Return type
datetime.datetime
- property date_added: datetime.datetime
raw field
addedDate
asdatetime.datetime
in local timezone.- Return type
datetime.datetime
- property date_started: datetime.datetime
raw field
startDate
asdatetime.datetime
in local timezone.- Return type
datetime.datetime
- property date_done: Optional[datetime.datetime]
the attribute “doneDate” as datetime.datetime. returns None if “doneDate” is invalid.
- format_eta()[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>.
- Return type
str
- property download_dir: Optional[str]
The download directory.
- Available
transmission version 1.5.
- Available
RPC version 4.
- property download_limit: Optional[int]
The download limit.
Can be a number or None.
- property peer_limit: int
the peer limit.
- property priority: str
Bandwidth priority as string. Can be one of ‘low’, ‘normal’, ‘high’. This is a mutator.
- property seed_idle_limit: int
seed idle limit in minutes.
- property is_finished: bool
Returns true if the torrent is finished (available from rpc version 2.0)
- property is_stalled: bool
Returns true if the torrent is stalled (available from rpc version 2.4)
- property size_when_done: int
Size in bytes when the torrent is done
- property total_size: int
Total size in bytes
- property left_until_done: int
Bytes left until done
- property desired_available: int
Bytes that are left to download and available
- property error: int
0
for fine task, non-zero for error torrent
- property error_string: str
empty string for fine task
- property available: float
Availability in percent
- property seed_idle_mode: str
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: float
Torrent seed ratio limit as float. Also see seed_ratio_mode. This is a mutator.
- Return type
float
- property seed_ratio_mode: str
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: Optional[int]
upload limit. Can be a number or None.
- property queue_position: int
queue position for this torrent.
- update(timeout=None)[source]
Update the torrent information.
- Parameters
timeout (Optional[Union[int, float, Tuple[Union[int, float], Union[int, float]]]]) –
- Return type
None
- start(bypass_queue=False, timeout=None)[source]
Start the torrent.
- Parameters
bypass_queue (bool) –
timeout (Optional[Union[int, float, Tuple[Union[int, float], Union[int, float]]]]) –
- Return type
None
- stop(timeout=None)[source]
Stop the torrent.
- Parameters
timeout (Optional[Union[int, float, Tuple[Union[int, float], Union[int, float]]]]) –
- Return type
None
- class transmission_rpc.torrent.Status[source]
A wrapped
str
for torrent status.returned by
Torrent.status
- stopped: bool
- check_pending: bool
- checking: bool
- download_pending: bool
- downloading: bool
- seed_pending: bool
- seeding: bool
- __init__()