summaryrefslogtreecommitdiffstats
path: root/module/plugins/internal/MultiHoster.py
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-10-18 19:08:02 +0200
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-10-18 19:08:02 +0200
commitb8e23365241337ebb8a42a0d93cbc67afbbee480 (patch)
tree5293dadec7c4aecf0fe32d9f6986c9987c1fbed9 /module/plugins/internal/MultiHoster.py
parent[Hoster] Fix download routine + new method is_download (diff)
downloadpyload-b8e23365241337ebb8a42a0d93cbc67afbbee480.tar.xz
[Plugin] Minimize code + spare fixes
Diffstat (limited to 'module/plugins/internal/MultiHoster.py')
-rw-r--r--module/plugins/internal/MultiHoster.py56
1 files changed, 11 insertions, 45 deletions
diff --git a/module/plugins/internal/MultiHoster.py b/module/plugins/internal/MultiHoster.py
index 5655571b8..a31a6843b 100644
--- a/module/plugins/internal/MultiHoster.py
+++ b/module/plugins/internal/MultiHoster.py
@@ -13,11 +13,11 @@ class MultiHoster(SimpleHoster):
__status__ = "testing"
__pattern__ = r'^unmatchable$'
- __config__ = [("activated" , "bool", "Activated" , True),
- ("use_premium" , "bool", "Use premium account if available" , True),
- ("fallback_premium", "bool", "Fallback to free download if premium fails", True),
- ("chk_filesize" , "bool", "Check file size" , True),
- ("revertfailed" , "bool", "Revert to standard download if fails" , True)]
+ __config__ = [("activated" , "bool", "Activated" , True),
+ ("use_premium" , "bool", "Use premium account if available" , True),
+ ("fallback" , "bool", "Fallback to free download if premium fails", True),
+ ("chk_filesize", "bool", "Check file size" , True),
+ ("revertfailed", "bool", "Revert to standard download if fails" , True)]
__description__ = """Multi hoster plugin"""
__license__ = "GPLv3"
@@ -66,47 +66,13 @@ class MultiHoster(SimpleHoster):
self.direct_dl = direct_dl
- def process(self, pyfile):
+ def _process(self, thread):
try:
- self.prepare()
- self.check_info() #@TODO: Remove in 0.4.10
+ super(MultiHoster, self)._process(thread)
- if self.direct_dl:
- self.log_info(_("Looking for direct download link..."))
- self.handle_direct(pyfile)
-
- if self.link or was_downloaded():
- self.log_info(_("Direct download link detected"))
- else:
- self.log_info(_("Direct download link not found"))
-
- if not self.link and not self.last_download:
- self.preload()
-
- self.check_errors()
- self.check_status(getinfo=False)
-
- if self.premium and (not self.CHECK_TRAFFIC or self.check_traffic()):
- self.log_info(_("Processing as premium download..."))
- self.handle_premium(pyfile)
-
- elif not self.LOGIN_ACCOUNT or (not self.CHECK_TRAFFIC or self.check_traffic()):
- self.log_info(_("Processing as free download..."))
- self.handle_free(pyfile)
-
- if not self.last_download:
- self.log_info(_("Downloading file..."))
- self.download(self.link, disposition=self.DISPOSITION)
-
- self.check_download()
-
- except Fail, e: #@TODO: Move to PluginThread in 0.4.10
- if self.premium:
- self.log_warning(_("Premium download failed"))
- self.restart(premium=False)
-
- elif self.get_config("revertfailed", True) and \
- self.pyload.pluginManager.hosterPlugins[self.classname].get('new_module'):
+ except Fail, e:
+ if self.get_config("revertfailed", True) and \
+ self.pyload.pluginManager.hosterPlugins[self.classname].get('new_module'):
hdict = self.pyload.pluginManager.hosterPlugins[self.classname]
tmp_module = hdict['new_module']
@@ -122,7 +88,7 @@ class MultiHoster(SimpleHoster):
self.restart(_("Revert to original hoster plugin"))
else:
- raise Fail(encode(e)) #@TODO: Remove `encode` in 0.4.10
+ raise Fail(e)
def handle_premium(self, pyfile):