summaryrefslogtreecommitdiffstats
path: root/module/plugins/internal/MultiHoster.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/internal/MultiHoster.py')
-rw-r--r--module/plugins/internal/MultiHoster.py64
1 files changed, 14 insertions, 50 deletions
diff --git a/module/plugins/internal/MultiHoster.py b/module/plugins/internal/MultiHoster.py
index 5655571b8..8baa577f9 100644
--- a/module/plugins/internal/MultiHoster.py
+++ b/module/plugins/internal/MultiHoster.py
@@ -9,15 +9,15 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, r
class MultiHoster(SimpleHoster):
__name__ = "MultiHoster"
__type__ = "hoster"
- __version__ = "0.53"
+ __version__ = "0.54"
__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"
@@ -35,10 +35,8 @@ class MultiHoster(SimpleHoster):
def _log(self, level, plugintype, pluginname, messages):
- return super(MultiHoster, self)._log(level,
- plugintype,
- pluginname,
- (self.PLUGIN_NAME,) + messages)
+ messages = (self.PLUGIN_NAME,) + messages
+ return self.plugin._log(level, plugintype, pluginname, messages)
def setup(self):
@@ -66,47 +64,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 +86,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):