From 729daf331c765a461748fea5afc73ea64c38e0a0 Mon Sep 17 00:00:00 2001 From: Chase Sterling Date: Tue, 24 Aug 2010 22:47:24 -0400 Subject: [PATCH] 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 99576f6cc..74c888579 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 fddea5dce..fffb599d3 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():