diff options
author | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-10-21 02:22:06 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-10-21 02:22:06 +0200 |
commit | 04f1a5eaf15a15fbebeeab7ddfb5b4cc33d22a3c (patch) | |
tree | 7ed913df154b790e698e306af32d58d650934db0 /module/plugins/internal/Base.py | |
parent | Boring code cosmetics (2) (diff) | |
download | pyload-04f1a5eaf15a15fbebeeab7ddfb5b4cc33d22a3c.tar.xz |
[Base] Improve wait method
Diffstat (limited to 'module/plugins/internal/Base.py')
-rw-r--r-- | module/plugins/internal/Base.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/module/plugins/internal/Base.py b/module/plugins/internal/Base.py index 71b67dfff..1262fce15 100644 --- a/module/plugins/internal/Base.py +++ b/module/plugins/internal/Base.py @@ -9,7 +9,7 @@ import urlparse from module.plugins.internal.Captcha import Captcha from module.plugins.internal.Plugin import Plugin, Abort, Fail, Reconnect, Retry, Skip -from module.plugins.internal.utils import (decode, encode, fixurl, format_time, +from module.plugins.internal.utils import (decode, encode, fixurl, format_size, format_time, parse_html_form, parse_name, replace_patterns) @@ -37,7 +37,7 @@ def create_getInfo(klass): class Base(Plugin): __name__ = "Base" __type__ = "base" - __version__ = "0.15" + __version__ = "0.16" __status__ = "testing" __pattern__ = r'^unmatchable$' @@ -65,7 +65,6 @@ class Base(Plugin): self.multiDL = True #@TODO: Change to `multi_dl` in 0.4.10 #: time.time() + wait in seconds - self.wait_until = 0 self.waiting = False #: Account handler instance, see :py:class:`Account` @@ -199,7 +198,7 @@ class Base(Plugin): size = self.pyfile.size if size: - self.log_info(_("Link size: %s bytes") % size) + self.log_info(_("Link size: %s (%s bytes)") % (format_size(size), size)) else: self.log_info(_("Link size: N/D")) @@ -329,17 +328,23 @@ class Base(Plugin): if reconnect is not None: self.set_reconnect(reconnect) + wait_time = pyfile.waitUntil - time.time() + + if wait_time < 1: + self.log_warning(_("Invalid wait time interval")) + return + self.waiting = True status = pyfile.status #@NOTE: Recheck in 0.4.10 pyfile.setStatus("waiting") - self.log_info(_("Waiting %s...") % format_time(pyfile.waitUntil - time.time())) + self.log_info(_("Waiting %s...") % format_time(wait_time)) if self.wantReconnect: self.log_info(_("Requiring reconnection...")) if self.account: - self.log_warning("Reconnection ignored due logged account") + self.log_warning(_("Reconnection ignored due logged account")) if not self.wantReconnect or self.account: while pyfile.waitUntil > time.time(): |