diff options
author | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-10-10 12:32:25 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-10-10 12:32:25 +0200 |
commit | 9f7f81e5eb6393d068a47a7395c89d2416db6f89 (patch) | |
tree | f93b91d431d27d597b2be617b056abb37893f8ed /module | |
parent | [Base] New methods: init_base and setup_base (diff) | |
download | pyload-9f7f81e5eb6393d068a47a7395c89d2416db6f89.tar.xz |
Spare code cosmetics (2)
Diffstat (limited to 'module')
-rw-r--r-- | module/plugins/internal/Account.py | 2 | ||||
-rw-r--r-- | module/plugins/internal/Addon.py | 2 | ||||
-rw-r--r-- | module/plugins/internal/MultiHoster.py | 4 | ||||
-rw-r--r-- | module/plugins/internal/Plugin.py | 10 | ||||
-rw-r--r-- | module/plugins/internal/SimpleHoster.py | 2 | ||||
-rw-r--r-- | module/plugins/internal/UnRar.py | 2 | ||||
-rw-r--r-- | module/plugins/internal/XFSHoster.py | 4 |
7 files changed, 10 insertions, 16 deletions
diff --git a/module/plugins/internal/Account.py b/module/plugins/internal/Account.py index a0c46a6a1..a1ecdd76f 100644 --- a/module/plugins/internal/Account.py +++ b/module/plugins/internal/Account.py @@ -40,7 +40,7 @@ class Account(Plugin): #: Callback of periodical job task self.cb = None - self.interval = None + self.interval = self.PERIODICAL_INTERVAL self.init() diff --git a/module/plugins/internal/Addon.py b/module/plugins/internal/Addon.py index 1c70cd4c9..bdde514c0 100644 --- a/module/plugins/internal/Addon.py +++ b/module/plugins/internal/Addon.py @@ -53,7 +53,7 @@ class Addon(Plugin): #: Callback of periodical job task, used by HookManager self.cb = None - self.interval = None + self.interval = self.PERIODICAL_INTERVAL self.init() self.init_events() diff --git a/module/plugins/internal/MultiHoster.py b/module/plugins/internal/MultiHoster.py index f5c3d091d..231615ae5 100644 --- a/module/plugins/internal/MultiHoster.py +++ b/module/plugins/internal/MultiHoster.py @@ -104,8 +104,8 @@ class MultiHoster(SimpleHoster): self.log_warning(_("Premium download failed")) self.restart(premium=False) - elif self.get_config("revertfailed", True) \ - and "new_module" in self.pyload.pluginManager.hosterPlugins[self.__name__]: + elif self.get_config("revertfailed", True) and \ + self.pyload.pluginManager.hosterPlugins[self.__name__].get('new_module'): hdict = self.pyload.pluginManager.hosterPlugins[self.__name__] tmp_module = hdict['new_module'] diff --git a/module/plugins/internal/Plugin.py b/module/plugins/internal/Plugin.py index faa362dbe..a2392fdcc 100644 --- a/module/plugins/internal/Plugin.py +++ b/module/plugins/internal/Plugin.py @@ -214,11 +214,11 @@ def parse_html_tag_attr_value(attr_name, tag): def parse_html_form(attr_str, html, input_names={}): for form in re.finditer(r"(?P<TAG><form[^>]*%s[^>]*>)(?P<CONTENT>.*?)</?(form|body|html)[^>]*>" % attr_str, - html, re.S | re.I): + html, re.I | re.S): inputs = {} action = parse_html_tag_attr_value("action", form.group('TAG')) - for inputtag in re.finditer(r'(<(input|textarea)[^>]*>)([^<]*(?=</\2)|)', form.group('CONTENT'), re.S | re.I): + for inputtag in re.finditer(r'(<(input|textarea)[^>]*>)([^<]*(?=</\2)|)', form.group('CONTENT'), re.I | re.S): name = parse_html_tag_attr_value("name", inputtag.group(1)) if name: value = parse_html_tag_attr_value("value", inputtag.group(1)) @@ -366,12 +366,6 @@ class Plugin(object): self.log_warning(_("Setting owner and group failed"), e) - def get_chunk_count(self): - if self.chunk_limit <= 0: - return self.pyload.config.get("download", "chunks") - return min(self.pyload.config.get("download", "chunks"), self.chunk_limit) - - def set_config(self, option, value, plugin=None): """ Set config value for current plugin diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 0f27ecc91..cf74c6646 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -270,7 +270,7 @@ class SimpleHoster(Hoster): if not self.link and not self.last_download: self.preload() - if 'status' not in self.info or self.info['status'] is 3: #@TODO: Recheck in 0.4.10 + if self.info.get('status', 3) is 3: #@TODO: Recheck in 0.4.10 self.check_info() if self.premium and (not self.CHECK_TRAFFIC or self.check_traffic()): diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py index f31a386a7..6f85c286a 100644 --- a/module/plugins/internal/UnRar.py +++ b/module/plugins/internal/UnRar.py @@ -38,7 +38,7 @@ class UnRar(Extractor): re_multipart = re.compile(r'\.(part|r)(\d+)(?:\.rar)?(\.rev|\.bad)?', re.I) re_filefixed = re.compile(r'Building (.+)') - re_filelist = re.compile(r'^(.)(\s*[\w\-.]+)\s+(\d+\s+)+(?:\d+\%\s+)?[\d\-]{8}\s+[\d\:]{5}', re.M|re.I) + re_filelist = re.compile(r'^(.)(\s*[\w\-.]+)\s+(\d+\s+)+(?:\d+\%\s+)?[\d\-]{8}\s+[\d\:]{5}', re.I | re.M) re_wrongpwd = re.compile(r'password', re.I) re_wrongcrc = re.compile(r'encrypted|damaged|CRC failed|checksum error|corrupt', re.I) diff --git a/module/plugins/internal/XFSHoster.py b/module/plugins/internal/XFSHoster.py index 3373c08d8..06715d2f1 100644 --- a/module/plugins/internal/XFSHoster.py +++ b/module/plugins/internal/XFSHoster.py @@ -158,7 +158,7 @@ class XFSHoster(SimpleHoster): action, inputs = self.parse_html_form('F1') if not inputs: - self.retry(msg=self.info['error'] if 'error' in self.info else _("TEXTAREA F1 not found")) + self.retry(msg=self.info.get('error') or _("TEXTAREA F1 not found")) self.log_debug(inputs) @@ -196,7 +196,7 @@ class XFSHoster(SimpleHoster): if not inputs: action, inputs = self.parse_html_form('F1') if not inputs: - self.retry(msg=self.info['error'] if 'error' in self.info else _("TEXTAREA F1 not found")) + self.retry(msg=self.info.get('error') or _("TEXTAREA F1 not found")) self.log_debug(inputs) |