diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-09-14 16:50:20 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-09-14 16:50:20 +0200 |
commit | 03374192ff2a74fea3c7a2201c3ef9ef929e3a39 (patch) | |
tree | 22087b62bab817b96f125f6e081e8008f6f09c49 /module/plugins/hoster | |
parent | Fixed EasybytezCom to work properly for registered (free) users (diff) | |
download | pyload-03374192ff2a74fea3c7a2201c3ef9ef929e3a39.tar.xz |
[BasePlugin] Little code cosmetics
Diffstat (limited to 'module/plugins/hoster')
-rw-r--r-- | module/plugins/hoster/BasePlugin.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/module/plugins/hoster/BasePlugin.py b/module/plugins/hoster/BasePlugin.py index 54d789054..573288ade 100644 --- a/module/plugins/hoster/BasePlugin.py +++ b/module/plugins/hoster/BasePlugin.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- -from re import match, search +import re + from urllib import unquote from urlparse import urlparse @@ -25,10 +26,11 @@ class BasePlugin(Hoster): self.chunkLimit = -1 self.resumeDownload = True + def process(self, pyfile): """main function""" - #debug part, for api exerciser + #: debug part, for api exerciser if pyfile.url.startswith("DEBUG_API"): self.multiDL = False return @@ -74,6 +76,7 @@ class BasePlugin(Hoster): else: self.fail("No Plugin matched and not a downloadable url.") + def downloadFile(self, pyfile): url = pyfile.url @@ -86,7 +89,7 @@ class BasePlugin(Hoster): if 'location' in header: self.logDebug("Location: " + header['location']) - base = match(r'https?://[^/]+', url).group(0) + base = re.match(r'https?://[^/]+', url).group(0) if header['location'].startswith("http"): url = header['location'] elif header['location'].startswith("/"): @@ -100,7 +103,7 @@ class BasePlugin(Hoster): if 'content-disposition' in header: self.logDebug("Content-Disposition: " + header['content-disposition']) - m = search("filename(?P<type>=|\*=(?P<enc>.+)'')(?P<name>.*)", header['content-disposition']) + m = re.search("filename(?P<type>=|\*=(?P<enc>.+)'')(?P<name>.*)", header['content-disposition']) if m: disp = m.groupdict() self.logDebug(disp) |