mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-18 14:26:24 +00:00
Fix #350 stop seeds when stop ratio is reached
This commit is contained in:
parent
9b60cdd241
commit
553ccd0a38
@ -507,8 +507,13 @@ class Torrent:
|
|||||||
|
|
||||||
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"]:
|
if self.config["stop_seed_at_ratio"] or self.stop_at_ratio:
|
||||||
if self.get_ratio() >= self.config["stop_seed_ratio"]:
|
if self.stop_at_ratio:
|
||||||
|
ratio = self.stop_ratio
|
||||||
|
else:
|
||||||
|
ratio = self.config["stop_seed_ratio"]
|
||||||
|
|
||||||
|
if self.get_ratio() >= ratio:
|
||||||
self.signals.emit("torrent_resume_at_stop_ratio")
|
self.signals.emit("torrent_resume_at_stop_ratio")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -180,13 +180,15 @@ class TorrentManager(component.Component):
|
|||||||
self.alerts.handle_alerts(True)
|
self.alerts.handle_alerts(True)
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
for torrent in self.torrents:
|
for torrent_id, torrent in self.torrents.items():
|
||||||
if self.config["stop_seed_at_ratio"] or torrent.stop_at_ratio:
|
if self.config["stop_seed_at_ratio"] or torrent.stop_at_ratio:
|
||||||
if (torrent.get_ratio() >= self.config["stop_seed_ratio"] or\
|
stop_ratio = self.config["stop_seed_ratio"]
|
||||||
torrent.get_ratio() > torrent.stop_ratio) and torrent.is_finished:
|
if torrent.stop_at_ratio:
|
||||||
|
stop_ratio = torrent.stop_ratio
|
||||||
|
if torrent.get_ratio() >= stop_ratio and torrent.is_finished:
|
||||||
torrent.pause()
|
torrent.pause()
|
||||||
if self.config["remove_seed_at_ratio"] or torrent.remove_at_ratio:
|
if self.config["remove_seed_at_ratio"] or torrent.remove_at_ratio:
|
||||||
self.remove(torrent.torrent_id)
|
self.remove(torrent_id)
|
||||||
|
|
||||||
def __getitem__(self, torrent_id):
|
def __getitem__(self, torrent_id):
|
||||||
"""Return the Torrent with torrent_id"""
|
"""Return the Torrent with torrent_id"""
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user