Ignore global stop ratio related settings in logic, so per torrent ones are used.
This commit is contained in:
parent
db1835d942
commit
729daf331c
|
@ -403,12 +403,11 @@ class Torrent(object):
|
||||||
else:
|
else:
|
||||||
status = self.status
|
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'
|
# 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_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
|
return ((status.all_time_download * stop_ratio) - status.all_time_upload) / status.upload_payload_rate
|
||||||
|
|
||||||
left = status.total_wanted - status.total_done
|
left = status.total_wanted - status.total_done
|
||||||
|
@ -773,13 +772,8 @@ class Torrent(object):
|
||||||
|
|
||||||
if self.handle.is_finished():
|
if self.handle.is_finished():
|
||||||
# If the torrent has already reached it's 'stop_seed_ratio' then do not do anything
|
# 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"]:
|
||||||
if self.options["stop_at_ratio"]:
|
if self.get_ratio() >= self.options["stop_ratio"]:
|
||||||
ratio = self.options["stop_ratio"]
|
|
||||||
else:
|
|
||||||
ratio = self.config["stop_seed_ratio"]
|
|
||||||
|
|
||||||
if self.get_ratio() >= ratio:
|
|
||||||
#XXX: This should just be returned in the RPC Response, no event
|
#XXX: This should just be returned in the RPC Response, no event
|
||||||
#self.signals.emit_event("torrent_resume_at_stop_ratio")
|
#self.signals.emit_event("torrent_resume_at_stop_ratio")
|
||||||
return
|
return
|
||||||
|
|
|
@ -260,16 +260,13 @@ class TorrentManager(component.Component):
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
for torrent_id, torrent in self.torrents.items():
|
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
|
# 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
|
# 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
|
continue
|
||||||
stop_ratio = self.config["stop_seed_ratio"]
|
if torrent.get_ratio() >= torrent.options["stop_ratio"] and torrent.is_finished:
|
||||||
if torrent.options["stop_at_ratio"]:
|
if torrent.options["remove_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"]:
|
|
||||||
self.remove(torrent_id)
|
self.remove(torrent_id)
|
||||||
break
|
break
|
||||||
if not torrent.handle.is_paused():
|
if not torrent.handle.is_paused():
|
||||||
|
|
Loading…
Reference in New Issue