mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-13 21:14:55 +00:00
Split up function calls in get_torrent_status() and add 'file_progress'
key. Patch from Sadrul.
This commit is contained in:
parent
f1d488a09c
commit
ae792ccb21
@ -229,11 +229,6 @@ class Torrent:
|
|||||||
distributed_copies = 0.0
|
distributed_copies = 0.0
|
||||||
|
|
||||||
full_status = {
|
full_status = {
|
||||||
"name": self.torrent_info.name(),
|
|
||||||
"total_size": self.torrent_info.total_size(),
|
|
||||||
"num_files": self.torrent_info.num_files(),
|
|
||||||
"num_pieces": self.torrent_info.num_pieces(),
|
|
||||||
"piece_length": self.torrent_info.piece_length(),
|
|
||||||
"distributed_copies": distributed_copies,
|
"distributed_copies": distributed_copies,
|
||||||
"total_done": self.status.total_done,
|
"total_done": self.status.total_done,
|
||||||
"total_uploaded": self.total_uploaded + self.status.total_payload_upload,
|
"total_uploaded": self.total_uploaded + self.status.total_payload_upload,
|
||||||
@ -250,8 +245,6 @@ class Torrent:
|
|||||||
"total_peers": self.status.num_incomplete,
|
"total_peers": self.status.num_incomplete,
|
||||||
"total_seeds": self.status.num_complete,
|
"total_seeds": self.status.num_complete,
|
||||||
"total_wanted": self.status.total_wanted,
|
"total_wanted": self.status.total_wanted,
|
||||||
"eta": self.get_eta(),
|
|
||||||
"ratio": self.get_ratio(),
|
|
||||||
"tracker": self.status.current_tracker,
|
"tracker": self.status.current_tracker,
|
||||||
"trackers": self.trackers,
|
"trackers": self.trackers,
|
||||||
"tracker_status": self.tracker_status,
|
"tracker_status": self.tracker_status,
|
||||||
@ -259,6 +252,18 @@ class Torrent:
|
|||||||
"files": self.files,
|
"files": self.files,
|
||||||
"file_priorities": self.file_priorities
|
"file_priorities": self.file_priorities
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fns = {
|
||||||
|
"name" : self.torrent_info.name,
|
||||||
|
"total_size" : self.torrent_info.total_size,
|
||||||
|
"num_files" : self.torrent_info.num_files,
|
||||||
|
"num_pieces" : self.torrent_info.num_pieces,
|
||||||
|
"piece_length" : self.torrent_info.piece_length,
|
||||||
|
"eta" : self.get_eta,
|
||||||
|
"ratio" : self.get_ratio,
|
||||||
|
"file_progress" : self.handle.file_progress
|
||||||
|
}
|
||||||
|
|
||||||
self.status = None
|
self.status = None
|
||||||
self.torrent_info = None
|
self.torrent_info = None
|
||||||
|
|
||||||
@ -271,6 +276,8 @@ class Torrent:
|
|||||||
for key in keys:
|
for key in keys:
|
||||||
if key in full_status:
|
if key in full_status:
|
||||||
status_dict[key] = full_status[key]
|
status_dict[key] = full_status[key]
|
||||||
|
elif key in fns:
|
||||||
|
status_dict[key] = fns[key]()
|
||||||
|
|
||||||
return status_dict
|
return status_dict
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user