Ticket #1308: seeds_peers_ratio.patch

File seeds_peers_ratio.patch, 1.9 KB (added by tecknicaltom, 14 years ago)

Patch to add seeds/peers ratio

  • deluge/core/torrent.py

    diff --git a/deluge/core/torrent.py b/deluge/core/torrent.py
    index f9f80ca..467f869 100644
    a b def get_status(self, keys, diff=False):  
    568568        if distributed_copies < 0:
    569569            distributed_copies = 0.0
    570570
     571        # Calculate the seeds:peers ratio
     572        if self.status.num_incomplete == 0:
     573            # Use -1.0 to signify infinity
     574            seeds_peers_ratio = -1.0
     575        else:
     576            seeds_peers_ratio = self.status.num_complete / float(self.status.num_incomplete)
     577
    571578        #if you add a key here->add it to core.py STATUS_KEYS too.
    572579        full_status = {
    573580            "active_time": self.status.active_time,
    def get_status(self, keys, diff=False):  
    595602            "remove_at_ratio": self.options["remove_at_ratio"],
    596603            "save_path": self.options["download_location"],
    597604            "seeding_time": self.status.seeding_time,
     605            "seeds_peers_ratio": seeds_peers_ratio,
    598606            "seed_rank": self.status.seed_rank,
    599607            "state": self.state,
    600608            "stop_at_ratio": self.options["stop_at_ratio"],
  • deluge/ui/gtkui/torrentview.py

    diff --git a/deluge/ui/gtkui/torrentview.py b/deluge/ui/gtkui/torrentview.py
    index bc1b908..c9ff32f 100644
    a b def __init__(self):  
    214214        self.add_func_column(_("Peers"), listview.cell_data_peer, [int, int],
    215215                             status_field=["num_peers", "total_peers"],
    216216                             sort_func=seed_peer_column_sort)
     217        self.add_func_column(_("Seeds/Peers"), listview.cell_data_ratio, [float],
     218                             status_field=["seeds_peers_ratio"])
    217219        self.add_func_column(_("Down Speed"), listview.cell_data_speed, [float],
    218220                             status_field=["download_payload_rate"])
    219221        self.add_func_column(_("Up Speed"), listview.cell_data_speed, [float],