diff options
Diffstat (limited to 'module/plugins/internal/SimpleHoster.py')
| -rw-r--r-- | module/plugins/internal/SimpleHoster.py | 26 | 
1 files changed, 15 insertions, 11 deletions
diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 47b713173..992454451 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -104,9 +104,9 @@ def parseFileInfo(plugin, url="", html=""):  #@TODO: Remove in 0.4.10 -#@NOTE: Every plugin must have own parseInfo classmethod to work with 0.4.10 +#@NOTE: Every plugin must have own parseInfos classmethod to work with 0.4.10  def create_getInfo(plugin): -    return lambda urls: [(info['name'], info['size'], info['status'], info['url']) for info in plugin.parseInfo(urls)] +    return lambda urls: [(info['name'], info['size'], info['status'], info['url']) for info in plugin.parseInfos(urls)]  def timestamp(): @@ -144,7 +144,7 @@ def _isDirectLink(self, url, resumable=True):  class SimpleHoster(Hoster):      __name__    = "SimpleHoster"      __type__    = "hoster" -    __version__ = "0.71" +    __version__ = "0.73"      __pattern__ = r'^unmatchable$' @@ -206,11 +206,10 @@ class SimpleHoster(Hoster):      FORCE_CHECK_TRAFFIC = False  #: Set to True to force checking traffic left for premium account      CHECK_DIRECT_LINK   = None   #: Set to True to check for direct link, set to None to do it only if self.account is True      MULTI_HOSTER        = False  #: Set to True to leech other hoster link (according its multihoster hook if available) -    CONTENT_DISPOSITION = False  #: Set to True to replace file name with content-disposition value from http header      @classmethod -    def parseInfo(cls, urls): +    def parseInfos(cls, urls):          for url in urls:              url = replace_patterns(url, cls.FILE_URL_REPLACEMENTS if hasattr(cls, "FILE_URL_REPLACEMENTS") else cls.URL_REPLACEMENTS)  #@TODO: Remove FILE_URL_REPLACEMENTS check in 0.4.10              yield cls.getInfo(url) @@ -319,8 +318,8 @@ class SimpleHoster(Hoster):              set_cookies(self.req.cj, self.COOKIES)          if (self.MULTI_HOSTER -            and self.__pattern__ != self.core.pluginManager.hosterPlugins[self.__name__]['pattern'] -            and re.match(self.__pattern__, self.pyfile.url) is None): +            and (self.__pattern__ != self.core.pluginManager.hosterPlugins[self.__name__]['pattern'] +                 or re.match(self.__pattern__, self.pyfile.url) is None)):              self.logInfo("Multi hoster detected") @@ -384,12 +383,17 @@ class SimpleHoster(Hoster):                  self.logDebug("Handled as free download")                  self.handleFree() -        if self.link: -            self.download(self.link, disposition=self.CONTENT_DISPOSITION) - +        self.downloadLink(self.link)          self.checkFile() +    def downloadLink(self, link): +        if not link: +            return + +        self.download(link, disposition=True) + +      def checkFile(self):          if self.checkDownload({'empty': re.compile(r"^$")}) is "empty":  #@TODO: Move to hoster in 0.4.10              self.fail(_("Empty file")) @@ -413,7 +417,7 @@ class SimpleHoster(Hoster):              if m:                  wait_time = sum([int(v) * {"hr": 3600, "hour": 3600, "min": 60, "sec": 1}[u.lower()] for v, u in                                   re.findall(r'(\d+)\s*(hr|hour|min|sec)', m.group(0), re.I)]) -                self.wait(wait_time, False) +                self.wait(wait_time, True if wait_time > 300 else False)                  return          self.info.pop('error', None)  | 
