Fix bug in calculating the ETA for seeding torrents with a stop seed

ratio set
This commit is contained in:
Andrew Resch 2008-11-21 07:49:15 +00:00
parent 0459202653
commit c028b861f8
3 changed files with 5 additions and 8 deletions

View File

@ -8,6 +8,7 @@ Deluge 1.1.0 - "" (In Development)
* Implement #368 add torrents by infohash/magnet uri (trackerless torrents) * Implement #368 add torrents by infohash/magnet uri (trackerless torrents)
* Remove remaining gtk functions in common * Remove remaining gtk functions in common
* Tracker icons. * Tracker icons.
* Add ETA for torrents with stop at seed ratio set
GtkUI: GtkUI:
* Add peer progress to the peers tab * Add peer progress to the peers tab

View File

@ -484,11 +484,7 @@ class Core(
def export_get_torrent_status(self, torrent_id, keys): def export_get_torrent_status(self, torrent_id, keys):
# Build the status dictionary # Build the status dictionary
try: status = self.torrents[torrent_id].get_status(keys)
status = self.torrents[torrent_id].get_status(keys)
except KeyError:
# The torrent_id is not found in the torrentmanager, so return None
return None
# Get the leftover fields and ask the plugin manager to fill them # Get the leftover fields and ask the plugin manager to fill them
leftover_fields = list(set(keys) - set(status.keys())) leftover_fields = list(set(keys) - set(status.keys()))
@ -496,7 +492,7 @@ class Core(
status.update(self.plugins.get_status(torrent_id, leftover_fields)) status.update(self.plugins.get_status(torrent_id, leftover_fields))
return status return status
def export_get_torrents_status(self, filter_dict, keys ): def export_get_torrents_status(self, filter_dict, keys):
""" """
returns all torrents , optionally filtered by filter_dict. returns all torrents , optionally filtered by filter_dict.
""" """
@ -506,7 +502,7 @@ class Core(
# Get the torrent status for each torrent_id # Get the torrent status for each torrent_id
for torrent_id in torrent_ids: for torrent_id in torrent_ids:
status_dict[torrent_id] = self.export_get_torrent_status(torrent_id, keys) status_dict[torrent_id] = self.export_get_torrent_status(torrent_id, keys)
# Emit the torrent_status signal to the clients
return status_dict return status_dict
def export_get_filter_tree(self , show_zero_hits=True, hide_cat=None): def export_get_filter_tree(self , show_zero_hits=True, hide_cat=None):

View File

@ -401,7 +401,7 @@ class Torrent:
# We're a seed, so calculate the time to the 'stop_share_ratio' # We're a seed, so calculate the time to the 'stop_share_ratio'
if not status.upload_payload_rate: if not status.upload_payload_rate:
return 0 return 0
stop_ratio = self.config["stop_seed_ratio"] if self.config["stop_at_seed_ratio"] else self.options["stop_seed_ratio"] stop_ratio = self.config["stop_seed_ratio"] if self.config["stop_seed_at_ratio"] else self.options["stop_seed_ratio"]
return ((status.all_time_download * stop_ratio) - status.all_time_upload) / status.upload_payload_rate return ((status.all_time_download * stop_ratio) - status.all_time_upload) / status.upload_payload_rate