summaryrefslogtreecommitdiffstats
path: root/pyload/plugins
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2014-11-14 00:12:31 +0100
committerGravatar Walter Purcaro <vuolter@gmail.com> 2014-11-14 00:50:45 +0100
commit11e546dec7683d1cb729e78f9b093506d5cde125 (patch)
tree8e8a714e417cf729f6486ebabd54e7eee9830722 /pyload/plugins
parentMerge branch 'stable' into 0.4.10 (diff)
downloadpyload-11e546dec7683d1cb729e78f9b093506d5cde125.tar.xz
[Plugin] Fix wait routine (thx rlindner81)
Diffstat (limited to 'pyload/plugins')
-rw-r--r--pyload/plugins/Plugin.py27
1 files changed, 18 insertions, 9 deletions
diff --git a/pyload/plugins/Plugin.py b/pyload/plugins/Plugin.py
index 43dbcfab3..18f0bc940 100644
--- a/pyload/plugins/Plugin.py
+++ b/pyload/plugins/Plugin.py
@@ -301,6 +301,12 @@ class Plugin(Base):
return True, 10
+ def setReconnect(self, reconnect):
+ reconnect = bool(reconnect)
+ self.logDebug("Set wantReconnect to: %s (previous: %s)" % (reconnect, self.wantReconnect))
+ self.wantReconnect = reconnect
+
+
def setWait(self, seconds, reconnect=None):
"""Set a specific wait time later used with `wait`
@@ -316,16 +322,19 @@ class Plugin(Base):
self.pyfile.waitUntil = wait_until
if reconnect is not None:
- self.logDebug("Set wantReconnect to: %s (previous: %s)" % (reconnect, self.wantReconnect))
- self.wantReconnect = reconnect
+ self.setReconnect(reconnect)
- def wait(self, seconds=0, reconnect=None):
+ def wait(self, seconds=None, reconnect=None):
""" waits the time previously set """
pyfile = self.pyfile
- self.setWait(seconds, reconnect)
+ if seconds is not None:
+ self.setWait(seconds)
+
+ if reconnect is not None:
+ self.setReconnect(reconnect)
self.waiting = True
@@ -336,10 +345,14 @@ class Plugin(Base):
"WAITUNTIL: %f" % pyfile.waitUntil,
"RECONNECT: %s" % self.wantReconnect)
- if not account:
+ if self.account:
self.logDebug("Ignore reconnection due account logged")
while pyfile.waitUntil > time():
+ if pyfile.abort:
+ self.abort()
+ else:
+ while pyfile.waitUntil > time():
self.thread.m.reconnecting.wait(2)
if pyfile.abort:
@@ -349,10 +362,6 @@ class Plugin(Base):
self.waiting = False
self.wantReconnect = False
raise Reconnect
- else:
- while pyfile.waitUntil > time():
- if pyfile.abort:
- self.abort()
self.waiting = False