summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2013-09-17 22:24:41 +0200
committerGravatar Walter Purcaro <vuolter@gmail.com> 2013-11-16 17:40:14 +0100
commita38b282781c1453cc89682ab8c1cff0ecf6704ce (patch)
tree8b65ddef7c1c81bf3e57be11000e085b5d370c42
parenttypo (diff)
downloadpyload-a38b282781c1453cc89682ab8c1cff0ecf6704ce.tar.xz
Improved start and stop methods
-rw-r--r--pyload/plugins/Addon.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/pyload/plugins/Addon.py b/pyload/plugins/Addon.py
index 60243a8bd..be317eb0d 100644
--- a/pyload/plugins/Addon.py
+++ b/pyload/plugins/Addon.py
@@ -107,20 +107,18 @@ class Addon(Base):
#self.startPeriodical()
self.init()
- def startPeriodical(self, interval=self.interval, wait=0):
- if not self.cb and self.setInterval(interval):
+ def startPeriodical(self, interval=self.interval, wait=self.interval):
+ if not self.cb and self.setInterval(interval, False):
self.cb = self.core.scheduler.addJob(wait, self._periodical, threaded=False)
return interval
else:
return False
def stopPeriodical(self):
- if not self.cb:
- return False
- r = self.core.scheduler.removeJob(self.cb)
- if r:
+ if self.cb and self.core.scheduler.removeJob(self.cb):
self.cb = None
- return r #: return True if successfully removed else False
+ return True
+ return False
def setInterval(self, interval, reset=False):
if interval > 0: