diff options
| author | 2015-04-13 09:22:01 +0200 | |
|---|---|---|
| committer | 2015-04-13 09:22:01 +0200 | |
| commit | 2432ade6c9bd7284a5bf0d760796638eef634be9 (patch) | |
| tree | 877cfd29c6e5117a974377ead73cbbc150f6544d /pyload/plugin/internal | |
| parent | Prepare hook plugins to merging from stable (diff) | |
| parent | [LolabitsEs] Cleanup (diff) | |
| download | pyload-2432ade6c9bd7284a5bf0d760796638eef634be9.tar.xz | |
Merge branch 'stable' into 0.4.10
Conflicts:
	module/plugins/hooks/MultihostersComHook.py
	module/plugins/hooks/PutdriveComHook.py
	module/plugins/internal/CaptchaService.py
	pyload/plugin/account/OboomCom.py
	pyload/plugin/account/SmoozedCom.py
	pyload/plugin/addon/AntiVirus.py
	pyload/plugin/addon/ExternalScripts.py
	pyload/plugin/addon/ExtractArchive.py
	pyload/plugin/addon/RestartSlow.py
	pyload/plugin/crypter/CrockoCom.py
	pyload/plugin/crypter/DepositfilesCom.py
	pyload/plugin/crypter/FshareVn.py
	pyload/plugin/crypter/LinkdecrypterCom.py
	pyload/plugin/crypter/MegaRapidCz.py
	pyload/plugin/crypter/PastebinCom.py
	pyload/plugin/hoster/CatShareNet.py
	pyload/plugin/hoster/EdiskCz.py
	pyload/plugin/hoster/ExtabitCom.py
	pyload/plugin/hoster/GigapetaCom.py
	pyload/plugin/hoster/GooIm.py
	pyload/plugin/hoster/IfolderRu.py
	pyload/plugin/hoster/LuckyShareNet.py
	pyload/plugin/hoster/MegasharesCom.py
	pyload/plugin/hoster/MovReelCom.py
	pyload/plugin/hoster/NarodRu.py
	pyload/plugin/hoster/NowDownloadSx.py
	pyload/plugin/hoster/NowVideoSx.py
	pyload/plugin/hoster/QuickshareCz.py
	pyload/plugin/hoster/RemixshareCom.py
	pyload/plugin/hoster/RgHostNet.py
	pyload/plugin/hoster/SendspaceCom.py
	pyload/plugin/hoster/UlozTo.py
	pyload/plugin/hoster/UnibytesCom.py
	pyload/plugin/hoster/UploadingCom.py
	pyload/plugin/hoster/WrzucTo.py
	pyload/plugin/internal/MultiHook.py
	pyload/plugin/internal/SimpleHoster.py
Diffstat (limited to 'pyload/plugin/internal')
| -rw-r--r-- | pyload/plugin/internal/BasePlugin.py | 12 | ||||
| -rw-r--r-- | pyload/plugin/internal/MultiHook.py | 20 | ||||
| -rw-r--r-- | pyload/plugin/internal/SimpleCrypter.py | 2 | ||||
| -rw-r--r-- | pyload/plugin/internal/SimpleDereferer.py | 2 | ||||
| -rw-r--r-- | pyload/plugin/internal/SimpleHoster.py | 46 | ||||
| -rw-r--r-- | pyload/plugin/internal/XFSHoster.py | 6 | 
6 files changed, 48 insertions, 40 deletions
diff --git a/pyload/plugin/internal/BasePlugin.py b/pyload/plugin/internal/BasePlugin.py index 0b6e8f102..7c83ddef0 100644 --- a/pyload/plugin/internal/BasePlugin.py +++ b/pyload/plugin/internal/BasePlugin.py @@ -13,7 +13,7 @@ from pyload.plugin.Hoster import Hoster  class BasePlugin(Hoster):      __name__    = "BasePlugin"      __type__    = "hoster" -    __version__ = "0.38" +    __version__ = "0.41"      __pattern__ = r'^unmatchable$' @@ -41,6 +41,16 @@ class BasePlugin(Hoster):          self.resumeDownload = True +    #: Work-around to `filename*=UTF-8` bug; remove in 0.4.10 +    def download(self, url, get={}, post={}, ref=True, cookies=True, disposition=False): +        try: +            if disposition: +                content = urllib2.urlopen(url).info()['Content-Disposition'].split(';') +                self.pyfile.name = content[1].split('filename=')[1][1:-1] or self.pyfile.name +        finally: +            return super(BasePlugin, self).download(url, get, post, ref, cookies, False) + +      def process(self, pyfile):          """main function""" diff --git a/pyload/plugin/internal/MultiHook.py b/pyload/plugin/internal/MultiHook.py index e15d5afda..4ca158c24 100644 --- a/pyload/plugin/internal/MultiHook.py +++ b/pyload/plugin/internal/MultiHook.py @@ -2,6 +2,7 @@  import re  import time +import traceback  from pyload.plugin.Hook import Hook  from pyload.utils import decode, remove_chars @@ -10,7 +11,7 @@ from pyload.utils import decode, remove_chars  class MultiHook(Hook):      __name__    = "MultiHook"      __type__    = "hook" -    __version__ = "0.40" +    __version__ = "0.44"      __config__  = [("pluginmode"    , "all;listed;unlisted", "Use for plugins"              , "all"),                     ("pluginlist"    , "str"                , "Plugin list (comma separated)", ""   ), @@ -64,20 +65,19 @@ class MultiHook(Hook):          self.pluginname   = None          self.plugintype   = None -        self._initPlugin() +        self.initPlugin() -    def _initPlugin(self): -        plugin = self.core.pluginManager.findPlugin("hoster", self.__class__.__name__) +    def initPlugin(self): +        self.pluginname         = self.__class__.__name__.rsplit("Hook", 1)[0] +        plugin, self.plugintype = self.core.pluginManager.findPlugin(self.pluginname) -        if not plugin: +        if plugin: +            self.pluginmodule = self.core.pluginManager.loadModule(self.plugintype, self.pluginname) +            self.pluginclass  = getattr(self.pluginmodule, self.pluginname) +        else:              self.logWarning("Hook plugin will be deactivated due missing plugin reference")              self.setConfig('activated', False) -        else: -            self.pluginname   = self.__class__.__name__ -            self.plugintype   = "hoster" -            self.pluginmodule = self.core.pluginManager.loadModule("hoster", self.__class__.__name__) -            self.pluginclass  = getattr(self.pluginmodule, self.__class__.__name__)      def loadAccount(self): diff --git a/pyload/plugin/internal/SimpleCrypter.py b/pyload/plugin/internal/SimpleCrypter.py index 472488268..d0380c0d9 100644 --- a/pyload/plugin/internal/SimpleCrypter.py +++ b/pyload/plugin/internal/SimpleCrypter.py @@ -20,7 +20,7 @@ class SimpleCrypter(Crypter, SimpleHoster):      __description__ = """Simple decrypter plugin"""      __license__     = "GPLv3" -    __authors__     = [("Walter Purcaro", "vuolter@gmail.com"  )] +    __authors__     = [("Walter Purcaro", "vuolter@gmail.com")]      """ diff --git a/pyload/plugin/internal/SimpleDereferer.py b/pyload/plugin/internal/SimpleDereferer.py index e24a7b836..a224c1e40 100644 --- a/pyload/plugin/internal/SimpleDereferer.py +++ b/pyload/plugin/internal/SimpleDereferer.py @@ -11,7 +11,7 @@ from pyload.plugin.internal.SimpleHoster import getFileURL, set_cookies  class SimpleDereferer(Crypter):      __name__    = "SimpleDereferer"      __type__    = "crypter" -    __version__ = "0.08" +    __version__ = "0.11"      __pattern__ = r'^unmatchable$'      __config__  = [("use_subfolder"     , "bool", "Save package to subfolder"          , True), diff --git a/pyload/plugin/internal/SimpleHoster.py b/pyload/plugin/internal/SimpleHoster.py index d83bbb625..56170a4fd 100644 --- a/pyload/plugin/internal/SimpleHoster.py +++ b/pyload/plugin/internal/SimpleHoster.py @@ -5,10 +5,8 @@ import mimetypes  import os  import re  import time - -from inspect import isclass -from urllib import unquote -from urlparse import urljoin, urlparse +import urllib +import urlparse  from pyload.datatype.File import statusMap as _statusMap  from pyload.network.CookieJar import CookieJar @@ -29,7 +27,7 @@ def _error(self, reason, type):          type = "unknown"      msg  = _("%s error") % type.strip().capitalize() if type else _("Error") -    msg += ": %s" % reason.strip() if reason else "" +    msg += (": %s" % reason.strip()) if reason else ""      msg += _(" | Plugin may be out of date")      raise Fail(msg) @@ -108,8 +106,8 @@ def parseFileInfo(plugin, url="", html=""):          info = plugin.getInfo(url, html)          res  = info['name'], info['size'], info['status'], info['url']      else: -        url   = unquote(url) -        url_p = urlparse(url) +        url   = urllib.unquote(url) +        url_p = urlparse.urlparse(url)          res   = ((url_p.path.split('/')[-1]                    or url_p.query.split('=', 1)[::-1][0].split('&', 1)[0]                    or url_p.netloc.split('.', 1)[0]), @@ -185,10 +183,10 @@ def getFileURL(self, url, follow_location=None):          elif 'location' in header and header['location'].strip():              location = header['location'] -            if not urlparse(location).scheme: -                url_p    = urlparse(url) +            if not urlparse.urlparse(location).scheme: +                url_p    = urlparse.urlparse(url)                  baseurl  = "%s://%s" % (url_p.scheme, url_p.netloc) -                location = urljoin(baseurl, location) +                location = urlparse.urljoin(baseurl, location)              if 'code' in header and header['code'] == 302:                  link = location @@ -198,7 +196,7 @@ def getFileURL(self, url, follow_location=None):                  continue          else: -            extension = os.path.splitext(urlparse(url).path.split('/')[-1])[-1] +            extension = os.path.splitext(urlparse.urlparse(url).path.split('/')[-1])[-1]              if 'content-type' in header and header['content-type'].strip():                  mimetype = header['content-type'].split(';')[0].strip() @@ -246,7 +244,7 @@ def secondsToMidnight(gmt=0):  class SimpleHoster(Hoster):      __name__    = "SimpleHoster"      __type__    = "hoster" -    __version__ = "1.31" +    __version__ = "1.37"      __pattern__ = r'^unmatchable$'      __config__  = [("use_premium", "bool", "Use premium account if available", True)] @@ -307,20 +305,21 @@ class SimpleHoster(Hoster):      DIRECT_LINK   = None   #: Set to True to looking for direct link (as defined in handleDirect method), set to None to do it if self.account is True else False      MULTI_HOSTER  = False  #: Set to True to leech other hoster link (as defined in handleMulti method)      LOGIN_ACCOUNT = False  #: Set to True to require account login -    DISPOSITION   = True   #: Work-around to `filename*=UTF-8` bug; remove in 0.4.10 +    DISPOSITION   = True   #: Set to True to use any content-disposition value in http header as file name      directLink = getFileURL  # @TODO: Remove in 0.4.10 +      @classmethod -    def parseInfos(cls, urls):  # @TODO: Built-in in 0.4.10 core, then remove from plugins +    def parseInfos(cls, urls):  #@TODO: Built-in in 0.4.10 core (remove from plugins)          for url in urls:              url = replace_patterns(url, cls.URL_REPLACEMENTS)              yield cls.getInfo(url)      @classmethod      def apiInfo(cls, url="", get={}, post={}): -        url   = unquote(url) -        url_p = urlparse(url) +        url   = urllib.unquote(url) +        url_p = urlparse.urlparse(url)          return {'name': (url_p.path.split('/')[-1]                           or url_p.query.split('=', 1)[::-1][0].split('&', 1)[0]                           or url_p.netloc.split('.', 1)[0]), @@ -386,7 +385,7 @@ class SimpleHoster(Hoster):              info['status'] = 2              if 'N' in info['pattern']: -                info['name'] = replace_patterns(unquote(info['pattern']['N'].strip()), +                info['name'] = replace_patterns(urllib.unquote(info['pattern']['N'].strip()),                                                  cls.NAME_REPLACEMENTS)              if 'S' in info['pattern']: @@ -478,7 +477,7 @@ class SimpleHoster(Hoster):                      self.logDebug("Handled as free download")                      self.handleFree(pyfile) -            self.downloadLink(self.link, self.DISPOSITION)  #: Remove `self.DISPOSITION` in 0.4.10 +            self.downloadLink(self.link, self.DISPOSITION)              self.checkFile()          except Fail, e:  # @TODO: Move to PluginThread in 0.4.10 @@ -492,10 +491,10 @@ class SimpleHoster(Hoster):          if link and isinstance(link, basestring):              self.correctCaptcha() -            if not urlparse(link).scheme: -                url_p   = urlparse(self.pyfile.url) +            if not urlparse.urlparse(link).scheme: +                url_p   = urlparse.urlparse(self.pyfile.url)                  baseurl = "%s://%s" % (url_p.scheme, url_p.netloc) -                link    = urljoin(baseurl, link) +                link    = urlparse.urljoin(baseurl, link)              self.download(link, ref=False, disposition=disposition) @@ -577,8 +576,8 @@ class SimpleHoster(Hoster):                  except Exception:                      waitmsg = m.group(0).strip() -                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)', waitmsg, re.I)) +                wait_time = sum(int(v) * {"hr": 3600, "hour": 3600, "min": 60, "sec": 1, "": 1}[u.lower()] for v, u in +                                re.findall(r'(\d+)\s*(hr|hour|min|sec|)', waitmsg, re.I))                  self.wait(wait_time, wait_time > 300)          self.info.pop('error', None) @@ -652,7 +651,6 @@ class SimpleHoster(Hoster):          if link:              self.logInfo(_("Direct download link detected")) -              self.link = link          else:              self.logDebug("Direct download link not found") diff --git a/pyload/plugin/internal/XFSHoster.py b/pyload/plugin/internal/XFSHoster.py index 58bcf0e09..0e265ce64 100644 --- a/pyload/plugin/internal/XFSHoster.py +++ b/pyload/plugin/internal/XFSHoster.py @@ -15,7 +15,7 @@ from pyload.utils import html_unescape  class XFSHoster(SimpleHoster):      __name__    = "XFSHoster"      __type__    = "hoster" -    __version__ = "0.45" +    __version__ = "0.46"      __pattern__ = r'^unmatchable$' @@ -181,8 +181,8 @@ class XFSHoster(SimpleHoster):              self.logWarning(re.sub(r"<.*?>", " ", self.errmsg))              if 'wait' in self.errmsg: -                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)', self.errmsg, re.I)) +                wait_time = sum(int(v) * {"hr": 3600, "hour": 3600, "min": 60, "sec": 1, "": 1}[u.lower()] for v, u in +                                re.findall(r'(\d+)\s*(hr|hour|min|sec|)', self.errmsg, re.I))                  self.wait(wait_time, wait_time > 300)              elif 'country' in self.errmsg:  | 
