diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-12-26 04:19:57 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-12-26 04:19:57 +0100 |
commit | f37514e315e076379ab73539ffa36e48671976cc (patch) | |
tree | 3560a73dfef20940bec22c76ca938c6b25aadf1c | |
parent | Rename AbstractExtractor to Extractor (diff) | |
download | pyload-f37514e315e076379ab73539ffa36e48671976cc.tar.xz |
[MultiHoster] Improve
-rw-r--r-- | module/plugins/internal/MultiHoster.py | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/module/plugins/internal/MultiHoster.py b/module/plugins/internal/MultiHoster.py index e5c28d034..6bfff171b 100644 --- a/module/plugins/internal/MultiHoster.py +++ b/module/plugins/internal/MultiHoster.py @@ -2,13 +2,13 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, replace_patterns, set_cookies class MultiHoster(SimpleHoster): __name__ = "MultiHoster" __type__ = "hoster" - __version__ = "0.24" + __version__ = "0.25" __pattern__ = r'^unmatchable$' @@ -17,7 +17,7 @@ class MultiHoster(SimpleHoster): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - DIRECT_LINK = True + LOGIN_ACCOUNT = True def setup(self): @@ -25,6 +25,28 @@ class MultiHoster(SimpleHoster): self.multiDL = self.premium + def prepare(self): + self.info = {} + self.link = "" #@TODO: Move to hoster class in 0.4.10 + self.directDL = False #@TODO: Move to hoster class in 0.4.10 + + if self.LOGIN_ACCOUNT and not self.account: + self.fail(_("Required account not found")) + + self.req.setOption("timeout", 120) + + if isinstance(self.COOKIES, list): + set_cookies(self.req.cj, self.COOKIES) + + if self.DIRECT_LINK is None: + self.directDL = self.__pattern__ != r'^unmatchable$' + else: + self.directDL = self.DIRECT_LINK + + self.pyfile.url = replace_patterns(self.pyfile.url, + self.FILE_URL_REPLACEMENTS if hasattr(self, "FILE_URL_REPLACEMENTS") else self.URL_REPLACEMENTS) #@TODO: Remove FILE_URL_REPLACEMENTS check in 0.4.10 + + def process(self, pyfile): self.prepare() @@ -35,7 +57,7 @@ class MultiHoster(SimpleHoster): if not self.link and not self.lastDownload: self.preload() - if self.premium and (not self.CHECK_TRAFFIC or self.checkTrafficLeft()): + if self.premium and not self.CHECK_TRAFFIC or self.checkTrafficLeft(): self.logDebug("Handled as premium download") self.handlePremium() @@ -55,4 +77,4 @@ class MultiHoster(SimpleHoster): if self.premium: raise NotImplementedError else: - self.logError(_("Required account not found")) + self.fail(_("Required premium account not found")) |