summaryrefslogtreecommitdiffstats
path: root/module/plugins/internal/MultiHoster.py
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2014-12-23 19:29:15 +0100
committerGravatar Walter Purcaro <vuolter@gmail.com> 2014-12-23 19:29:15 +0100
commita4786e340993bbfc5d2bf971c9bec18863d3dd80 (patch)
tree4e17e7d7a6bf7a30b472de42a2edc7cda2e6c186 /module/plugins/internal/MultiHoster.py
parent[SimpleHoster] Code cosmetics (diff)
downloadpyload-a4786e340993bbfc5d2bf971c9bec18863d3dd80.tar.xz
[MultiHoster] Update
Diffstat (limited to 'module/plugins/internal/MultiHoster.py')
-rw-r--r--module/plugins/internal/MultiHoster.py53
1 files changed, 24 insertions, 29 deletions
diff --git a/module/plugins/internal/MultiHoster.py b/module/plugins/internal/MultiHoster.py
index 4425cfce0..e5c28d034 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, replace_patterns, set_cookies
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class MultiHoster(SimpleHoster):
__name__ = "MultiHoster"
__type__ = "hoster"
- __version__ = "0.23"
+ __version__ = "0.24"
__pattern__ = r'^unmatchable$'
@@ -18,9 +18,6 @@ class MultiHoster(SimpleHoster):
DIRECT_LINK = True
- MULTI_HOSTER = True
- LOGIN_ACCOUNT = True
- LOGIN_PREMIUM = False
def setup(self):
@@ -28,36 +25,34 @@ class MultiHoster(SimpleHoster):
self.multiDL = self.premium
- def prepare(self):
- self.info = {}
- self.link = ""
- self.multihost = False
+ def process(self, pyfile):
+ self.prepare()
- self.req.setOption("timeout", 120)
+ if self.directDL:
+ self.logDebug("Looking for direct download link...")
+ self.handleDirect()
- if isinstance(self.COOKIES, list):
- set_cookies(self.req.cj, self.COOKIES)
+ if not self.link and not self.lastDownload:
+ self.preload()
- if self.DIRECT_LINK is None:
- self.directDL = bool(self.account)
- else:
- self.directDL = self.DIRECT_LINK
+ if self.premium and (not self.CHECK_TRAFFIC or self.checkTrafficLeft()):
+ self.logDebug("Handled as premium download")
+ self.handlePremium()
- if (self.__pattern__ != self.core.pluginManager.hosterPlugins[self.__name__]['pattern']
- or re.match(self.__pattern__, self.pyfile.url) is None):
+ else:
+ self.logDebug("Handled as free download")
+ self.handleFree()
- if self.LOGIN_ACCOUNT and not self.account:
- self.logError(_("Required account not found"))
+ self.downloadLink(self.link)
+ self.checkFile()
- elif self.LOGIN_PREMIUM and not self.premium:
- self.logError(_("Required premium account not found"))
- else:
- self.multihost = True
+ def handlePremium(self):
+ return self.handleFree()
- 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 handleMulti(self):
- raise NotImplementedError
+ def handleFree(self):
+ if self.premium:
+ raise NotImplementedError
+ else:
+ self.logError(_("Required account not found"))