diff options
author | Stefano <l.stickell@yahoo.it> | 2013-07-22 20:50:34 +0200 |
---|---|---|
committer | Stefano <l.stickell@yahoo.it> | 2013-07-22 21:20:06 +0200 |
commit | aaaf5a4cddec894aacd7400c59a9f2f5e710362f (patch) | |
tree | 9d9e89aff86598b3ffcc86117abd554b193e28b5 /pyload/plugins/hoster/BasePlugin.py | |
parent | implemented media type filter (diff) | |
download | pyload-aaaf5a4cddec894aacd7400c59a9f2f5e710362f.tar.xz |
Fixed PEP 8 violations in Hosters
(cherry picked from commit 2edeee0532ec6d6b4b26fd045a5971f67ca455da)
Conflicts:
pyload/plugins/hoster/BasePlugin.py
pyload/plugins/hoster/MultishareCz.py
pyload/plugins/hoster/NetloadIn.py
pyload/plugins/hoster/PremiumizeMe.py
pyload/plugins/hoster/RapidshareCom.py
Diffstat (limited to 'pyload/plugins/hoster/BasePlugin.py')
-rw-r--r-- | pyload/plugins/hoster/BasePlugin.py | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/pyload/plugins/hoster/BasePlugin.py b/pyload/plugins/hoster/BasePlugin.py index 552e7bc73..85d3c8ed6 100644 --- a/pyload/plugins/hoster/BasePlugin.py +++ b/pyload/plugins/hoster/BasePlugin.py @@ -8,12 +8,13 @@ from module.network.HTTPRequest import BadHeader from module.plugins.Hoster import Hoster from module.utils import html_unescape, remove_chars + class BasePlugin(Hoster): __name__ = "BasePlugin" __type__ = "hoster" __pattern__ = r"^unmatchable$" - __version__ = "0.17" - __description__ = """Base Plugin when any other didn't match""" + __version__ = "0.18" + __description__ = """Base Plugin when any other didn't fit""" __author_name__ = ("RaNaN") __author_mail__ = ("RaNaN@pyload.org") @@ -34,11 +35,11 @@ class BasePlugin(Hoster): self.decryptCaptcha("http://forum.pyload.org/lib/tpl/pyload/images/pyload-logo-edited3.5-new-font-small.png", imgtype="png") self.download("http://download.pyload.org/random100.bin") return -# -# if pyfile.url == "79": -# self.core.api.addPackage("test", [str(i) for i in range(80)], 1) -# -# return + # + # if pyfile.url == "79": + # self.core.api.addPackage("test", [str(i) for i in range(80)], 1) + # + # return if pyfile.url.startswith("http"): try: @@ -48,7 +49,7 @@ class BasePlugin(Hoster): self.logDebug("Auth required") account = self.core.accountManager.getAccountPlugin('Http') - servers = [ x['login'] for x in account.getAllAccounts() ] + servers = [x['login'] for x in account.getAllAccounts()] server = urlparse(pyfile.url).netloc if server in servers: @@ -69,15 +70,14 @@ class BasePlugin(Hoster): else: self.fail("No Plugin matched and not a downloadable url.") - def downloadFile(self, pyfile): url = pyfile.url for i in range(5): - header = self.load(url, just_header = True) + header = self.load(url, just_header=True) # self.load does not raise a BadHeader on 404 responses, do it here - if header.has_key('code') and header['code'] == 404: + if 'code' in header and header['code'] == 404: raise BadHeader(404) if 'location' in header: @@ -94,11 +94,13 @@ class BasePlugin(Hoster): if m: disp = m.groupdict() self.logDebug(disp) - if not disp['enc']: disp['enc'] = 'utf-8' - name = remove_chars(disp['name'], "\"';/").strip() + if not disp['enc']: + disp['enc'] = 'utf-8' + name = remove_chars(disp['name'], "\"';").strip() name = unicode(unquote(name), disp['enc']) - if not name: name = url + if not name: + name = url pyfile.name = name self.logDebug("Filename: %s" % pyfile.name) self.download(url, disposition=True) |