From 03374192ff2a74fea3c7a2201c3ef9ef929e3a39 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 14 Sep 2014 16:50:20 +0200 Subject: [BasePlugin] Little code cosmetics --- module/plugins/hoster/BasePlugin.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'module') 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=|\*=(?P.+)'')(?P.*)", header['content-disposition']) + m = re.search("filename(?P=|\*=(?P.+)'')(?P.*)", header['content-disposition']) if m: disp = m.groupdict() self.logDebug(disp) -- cgit v1.2.3