Feature #1308: Add Seeds/Peers ratio to torrent list view

This commit is contained in:
Calum Lind 2011-05-22 22:48:03 +01:00
parent b0599313bc
commit 85b4ceec30
2 changed files with 10 additions and 0 deletions

View File

@ -620,6 +620,13 @@ class Torrent(object):
if distributed_copies < 0:
distributed_copies = 0.0
# Calculate the seeds:peers ratio
if self.status.num_incomplete == 0:
# Use -1.0 to signify infinity
seeds_peers_ratio = -1.0
else:
seeds_peers_ratio = self.status.num_complete / float(self.status.num_incomplete)
full_status = {
"active_time": self.status.active_time,
"all_time_download": self.status.all_time_download,
@ -651,6 +658,7 @@ class Torrent(object):
"remove_at_ratio": self.options["remove_at_ratio"],
"save_path": self.options["download_location"],
"seeding_time": self.status.seeding_time,
"seeds_peers_ratio": seeds_peers_ratio,
"seed_rank": self.status.seed_rank,
"state": self.state,
"stop_at_ratio": self.options["stop_at_ratio"],

View File

@ -235,6 +235,8 @@ class TorrentView(listview.ListView, component.Component):
self.add_func_column(_("Peers"), listview.cell_data_peer, [int, int],
status_field=["num_peers", "total_peers"],
sort_func=seed_peer_column_sort)
self.add_func_column(_("Seeders") + "/" + _("Peers"), listview.cell_data_ratio, [float],
status_field=["seeds_peers_ratio"])
self.add_func_column(_("Down Speed"), listview.cell_data_speed, [float],
status_field=["download_payload_rate"])
self.add_func_column(_("Up Speed"), listview.cell_data_speed, [float],