Module: deluge Branch: master Commit: 729daf331c765a461748fea5afc73ea64c38e0a0
Author: Chase Sterling <[email protected]> Date: Tue Aug 24 22:47:24 2010 -0400 Ignore global stop ratio related settings in logic, so per torrent ones are used. --- deluge/core/torrent.py | 14 ++++---------- deluge/core/torrentmanager.py | 11 ++++------- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/deluge/core/torrent.py b/deluge/core/torrent.py index 99576f6..74c8885 100644 --- a/deluge/core/torrent.py +++ b/deluge/core/torrent.py @@ -403,12 +403,11 @@ class Torrent(object): else: status = self.status - if self.is_finished and (self.options["stop_at_ratio"] or self.config["stop_seed_at_ratio"]): + if self.is_finished and self.options["stop_at_ratio"]: # We're a seed, so calculate the time to the 'stop_share_ratio' if not status.upload_payload_rate: return 0 - stop_ratio = self.config["stop_seed_ratio"] if self.config["stop_seed_at_ratio"] else self.options["stop_ratio"] - + stop_ratio = self.options["stop_ratio"] return ((status.all_time_download * stop_ratio) - status.all_time_upload) / status.upload_payload_rate left = status.total_wanted - status.total_done @@ -773,13 +772,8 @@ class Torrent(object): if self.handle.is_finished(): # If the torrent has already reached it's 'stop_seed_ratio' then do not do anything - if self.config["stop_seed_at_ratio"] or self.options["stop_at_ratio"]: - if self.options["stop_at_ratio"]: - ratio = self.options["stop_ratio"] - else: - ratio = self.config["stop_seed_ratio"] - - if self.get_ratio() >= ratio: + if self.options["stop_at_ratio"]: + if self.get_ratio() >= self.options["stop_ratio"]: #XXX: This should just be returned in the RPC Response, no event #self.signals.emit_event("torrent_resume_at_stop_ratio") return diff --git a/deluge/core/torrentmanager.py b/deluge/core/torrentmanager.py index fddea5d..fffb599 100644 --- a/deluge/core/torrentmanager.py +++ b/deluge/core/torrentmanager.py @@ -260,16 +260,13 @@ class TorrentManager(component.Component): def update(self): for torrent_id, torrent in self.torrents.items(): - if self.config["stop_seed_at_ratio"] or torrent.options["stop_at_ratio"] and torrent.state not in ("Checking", "Allocating", "Paused", "Queued"): + if torrent.options["stop_at_ratio"] and torrent.state not in ("Checking", "Allocating", "Paused", "Queued"): # If the global setting is set, but the per-torrent isn't.. Just skip to the next torrent # This is so that a user can turn-off the stop at ratio option on a per-torrent basis - if self.config["stop_seed_at_ratio"] and not torrent.options["stop_at_ratio"]: + if not torrent.options["stop_at_ratio"]: continue - stop_ratio = self.config["stop_seed_ratio"] - if torrent.options["stop_at_ratio"]: - stop_ratio = torrent.options["stop_ratio"] - if torrent.get_ratio() >= stop_ratio and torrent.is_finished: - if self.config["remove_seed_at_ratio"] or torrent.options["remove_at_ratio"]: + if torrent.get_ratio() >= torrent.options["stop_ratio"] and torrent.is_finished: + if torrent.options["remove_at_ratio"]: self.remove(torrent_id) break if not torrent.handle.is_paused(): -- 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.
