Skip to content

Commit 858d570

Browse files
author
Sam
committed
Now ignores both seeding torrents, and those that have been queued to seed only.
Also fixed bug with debug message.
1 parent df274aa commit 858d570

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

Diff for: managedpause/core.py

+12-6
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def on_torrent_added(self, torrent_id):
114114
# only apply the pause action to avoid interfering with the user option
115115
# 'add torrent as paused'
116116
if state == "Red":
117-
log.debug("MANAGEDPAUSE [TORRENT ADDED]: paused new torrent, %s" % torrent.get_status(["name"]))
117+
log.debug("MANAGEDPAUSE [TORRENT ADDED]: paused new torrent, %s" % torrent.get_status(["name"]).get("name", "NO NAME"))
118118
torrent.pause()
119119

120120
def on_session_resumed(self):
@@ -130,11 +130,17 @@ def _set_managed_torrents_state(self, active):
130130
log.debug("MANAGEDPAUSE [SET STATE]: currently have %d torrents." % len(torrents))
131131
for t in torrents.values():
132132
log.debug("MANAGEDPAUSE [SET STATE]: %s, auto-managed %s, currently %s" % (t.filename, t.options["auto_managed"], t.state))
133-
if t.options["auto_managed"] and (not self.config["ignore_seeding"] or t.state != "Seeding"):
134-
if active:
135-
t.resume()
136-
else:
137-
t.pause()
133+
if t.options["auto_managed"]:
134+
# if we're not ignoring seeding, OR we are ignoring seeding and not ...
135+
if not self.config["ignore_seeding"] or not (
136+
# seeding
137+
t.state == "Seeding" or
138+
# queued and completed, so just waiting to seed
139+
(t.state == "Queued" and t.get_status(["progress"]).get("progress", 0) >= 100)):
140+
if active:
141+
t.resume()
142+
else:
143+
t.pause()
138144

139145
def do_schedule(self, timer=True):
140146
"""

0 commit comments

Comments
 (0)