diff options
| author | 2014-03-31 15:42:28 +0200 | |
|---|---|---|
| committer | 2014-06-28 02:50:17 +0200 | |
| commit | 10b0980e23835a02b598c63fca0ec0b02c64d47a (patch) | |
| tree | b71e716fbba802608d72cc8c37abef02db5770d0 /module | |
| parent | Removed deprecated module. (diff) | |
| download | pyload-10b0980e23835a02b598c63fca0ec0b02c64d47a.tar.xz | |
Improved wait method
Diffstat (limited to 'module')
| -rw-r--r-- | module/plugins/Plugin.py | 18 | 
1 files changed, 13 insertions, 5 deletions
| diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py index 584fcce49..1ba84a762 100644 --- a/module/plugins/Plugin.py +++ b/module/plugins/Plugin.py @@ -142,7 +142,7 @@ class Plugin(Base):      Overwrite `process` / `decrypt` in your subclassed plugin.      """      __name__ = "Plugin" -    __version__ = "0.4" +    __version__ = "0.5"      __pattern__ = None      __type__ = "hoster"      __config__ = [("name", "type", "desc", "default")] @@ -261,7 +261,7 @@ class Plugin(Base):          return True, 10 -    def setWait(self, seconds, reconnect=False): +    def setWait(self, seconds, reconnect=None):          """Set a specific wait time later used with `wait`          :param seconds: wait time in seconds @@ -271,15 +271,23 @@ class Plugin(Base):              self.wantReconnect = True          self.pyfile.waitUntil = time() + int(seconds) -    def wait(self): -        """ waits the time previously set """ +    def wait(self, seconds=None, reconnect=None): +        """ Waits the time previously set or use these from arguments. See `setWait` +        """ +        if seconds: +            self.setWait(seconds, reconnect) + +        self._wait() + +    def _wait(self):          self.waiting = True          self.pyfile.setStatus("waiting")          while self.pyfile.waitUntil > time():              self.thread.m.reconnecting.wait(2) -            if self.pyfile.abort: raise Abort +            if self.pyfile.abort: +                raise Abort              if self.thread.m.reconnecting.isSet():                  self.waiting = False                  self.wantReconnect = False | 
