summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster/BasePlugin.py
diff options
context:
space:
mode:
authorGravatar Stefano <l.stickell@yahoo.it> 2013-07-22 20:50:34 +0200
committerGravatar Stefano <l.stickell@yahoo.it> 2013-07-22 20:50:34 +0200
commit2edeee0532ec6d6b4b26fd045a5971f67ca455da (patch)
tree8d656afc9c18f7dba7c05d6635f898fdf58d66d6 /module/plugins/hoster/BasePlugin.py
parentFixed PEP 8 violations in Crypters (diff)
downloadpyload-2edeee0532ec6d6b4b26fd045a5971f67ca455da.tar.xz
Fixed PEP 8 violations in Hosters
Diffstat (limited to 'module/plugins/hoster/BasePlugin.py')
-rw-r--r--module/plugins/hoster/BasePlugin.py40
1 files changed, 21 insertions, 19 deletions
diff --git a/module/plugins/hoster/BasePlugin.py b/module/plugins/hoster/BasePlugin.py
index f8d494e39..332921dc4 100644
--- a/module/plugins/hoster/BasePlugin.py
+++ b/module/plugins/hoster/BasePlugin.py
@@ -8,11 +8,12 @@ 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"
+ __version__ = "0.18"
__description__ = """Base Plugin when any other didnt fit"""
__author_name__ = ("RaNaN")
__author_mail__ = ("RaNaN@pyload.org")
@@ -29,17 +30,17 @@ class BasePlugin(Hoster):
self.multiDL = False
return
-# self.__name__ = "NetloadIn"
-# pyfile.name = "test"
-# self.html = self.load("http://localhost:9000/short")
-# self.download("http://localhost:9000/short")
-# self.api = self.load("http://localhost:9000/short")
-# self.decryptCaptcha("http://localhost:9000/captcha")
-#
-# if pyfile.url == "79":
-# self.core.api.addPackage("test", [str(i) for i in range(80)], 1)
-#
-# return
+ # self.__name__ = "NetloadIn"
+ # pyfile.name = "test"
+ # self.html = self.load("http://localhost:9000/short")
+ # self.download("http://localhost:9000/short")
+ # self.api = self.load("http://localhost:9000/short")
+ # self.decryptCaptcha("http://localhost:9000/captcha")
+ #
+ # if pyfile.url == "79":
+ # self.core.api.addPackage("test", [str(i) for i in range(80)], 1)
+ #
+ # return
if pyfile.url.startswith("http"):
try:
@@ -49,7 +50,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:
@@ -70,15 +71,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:
@@ -95,11 +95,13 @@ class BasePlugin(Hoster):
if m:
disp = m.groupdict()
self.logDebug(disp)
- if not disp['enc']: disp['enc'] = 'utf-8'
+ 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) \ No newline at end of file
+ self.download(url, disposition=True)