Module: deluge
Branch: 1.3-stable
Commit: b93477c41ea55dcc7c4744c98165008570f05559
Author: tecknicaltom <tecknicaltom>
Date: Sun May 22 02:08:24 2011 +0100
Feature #1308: Add Seeds/Peers ratio to torrent list view
---
deluge/core/torrent.py | 8 ++++++++
deluge/ui/gtkui/torrentview.py | 2 ++
2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/deluge/core/torrent.py b/deluge/core/torrent.py
index 9e0a609..f1dd5e7 100644
--- a/deluge/core/torrent.py
+++ b/deluge/core/torrent.py
@@ -572,6 +572,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)
+
#if you add a key here->add it to core.py STATUS_KEYS too.
full_status = {
"active_time": self.status.active_time,
@@ -601,6 +608,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"],
diff --git a/deluge/ui/gtkui/torrentview.py b/deluge/ui/gtkui/torrentview.py
index 898bc38..b2687b0 100644
--- a/deluge/ui/gtkui/torrentview.py
+++ b/deluge/ui/gtkui/torrentview.py
@@ -231,6 +231,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],
--
You received this message because you are subscribed to the Google Groups
"deluge-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/deluge-commit?hl=en.