Torrent
- class transmission_rpc.torrent.Torrent[source]
Torrent is a dataclasses holding the data received from Transmission regarding a bittorrent transfer.
- property activity_date: datetime
The last time we uploaded or downloaded piece data on this torrent.
- property added_date: datetime
When the torrent was first added.
- property available: float
Availability in percent
- property bandwidth_priority: int
TODO An array of pieceCount numbers representing the number of connected peers that have each piece, or -1 if we already have the piece ourselves.
- property corrupt_ever: int
Byte count of all the corrupt data you’ve ever downloaded for this torrent. If you’re on a poisoned torrent, this number can grow very large.
- property desired_available: int
Byte count of all the piece data we want and don’t have yet, but that a connected peer does have. [0…leftUntilDone]
- property done_date: datetime
When the torrent finished downloading.
- property download_dir: Optional[str]
The download directory.
- Available
transmission version 1.5.
- Available
RPC version 4.
- property downloaded_ever: int
Byte count of all the non-corrupt data you’ve ever downloaded for this torrent. If you deleted the files and downloaded a second time, this will be 2*totalSize.
- property edit_date: datetime
The last time during this session that a rarely-changing field changed – e.g. any tr_torrent_metainfo field (trackers, filenames, name) or download directory. RPC clients can monitor this to know when to reload fields that rarely change.
- property error: int
0
for fine task, non-zero for error torrent
- property error_string: str
empty string for fine task
- property eta: Optional[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.
- 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[File]
- property have_unchecked: int
Byte count of all the partial piece data we have for this torrent. As pieces become complete, this value may decrease as portions of it are moved to `corrupt’ or `haveValid’.
- property have_valid: int
Byte count of all the checksum-verified data we have for this torrent.
- property honors_session_limits: bool
true if session upload limits are honored
- property left_until_done: int
Byte count of how much data is left to be downloaded until we’ve got all the pieces that we want. [0…tr_stat.sizeWhenDone]
- property metadata_percent_complete: float
How much of the metadata the torrent has. For torrents added from a torrent this will always be 1. For magnet links, this number will from from 0 to 1 as the metadata is downloaded. Range is [0..1]
- property peer_limit: int
maximum number of peers
- property peers_connected: int
Number of peers that we’re connected to
- property peers_from: int
How many peers we found out about from the tracker, or from pex, or from incoming connections, or from our resume file.
- property peers_getting_from_us: int
Number of peers that we’re sending data to
- property peers_sending_to_us: int
Number of peers that are sending data to us.
- property percent_complete: float
How much has been downloaded of the entire torrent. Range is [0..1]
- property percent_done: float
How much has been downloaded of the files the user wants. This differs from percentComplete if the user wants only some of the torrent’s files. Range is [0..1]
- property pieces: str
A bitfield holding pieceCount flags which are set to ‘true’ if we have the piece matching that position.
JSON doesn’t allow raw binary data, so this is a base64-encoded string. (Source: tr_torrent)
- property queue_position: int
position of this torrent in its queue [0…n)
- property rate_download: int
download rate (B/s)
- property rate_upload: int
upload rate (B/s)
- property tracker_list: List[str]
list of str of announce URLs
- property torrent_file: str
torrent file location on transmission server
Examples
/var/lib/transmission-daemon/.config/transmission-daemon/torrents/00000000000000000000000000.torrent
- property webseeds_sending_to_us: int
Number of webseeds that are sending data to us.
- property status: Status
Status
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'
- Type
rtype
- property progress: float
download progress in percent.
- Return type
float
- property ratio: float
upload/download ratio.
- Return type
float
- property date_active: 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.
- property date_added: datetime
raw field
addedDate
asdatetime.datetime
in utc timezone.
- property date_started: datetime
raw field
startDate
asdatetime.datetime
in utc timezone.
- property date_done: Optional[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 priority: str
Bandwidth priority as string. Can be one of ‘low’, ‘normal’, ‘high’. This is a mutator.
- 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.
- 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.
- 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__()