diff options
author | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-06-17 18:29:50 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-06-24 22:42:29 +0200 |
commit | 164512b6a74c94a731fcee7435dce1ccfa2f71e7 (patch) | |
tree | 3f61d3b83f641070145b478f54522c4fe2e63691 /module/plugins/hoster | |
parent | Spare fixes (diff) | |
download | pyload-164512b6a74c94a731fcee7435dce1ccfa2f71e7.tar.xz |
Spare code cosmetics
Diffstat (limited to 'module/plugins/hoster')
22 files changed, 74 insertions, 45 deletions
diff --git a/module/plugins/hoster/BasePlugin.py b/module/plugins/hoster/BasePlugin.py index de5bca207..82311dd6b 100644 --- a/module/plugins/hoster/BasePlugin.py +++ b/module/plugins/hoster/BasePlugin.py @@ -41,8 +41,9 @@ class BasePlugin(Hoster): def process(self, pyfile): - """main function""" - + """ + Main function + """ pyfile.name = self.getInfo(pyfile.url)['name'] if not pyfile.url.startswith("http"): diff --git a/module/plugins/hoster/BasketbuildCom.py b/module/plugins/hoster/BasketbuildCom.py index 89e4d39f9..cfc945464 100644 --- a/module/plugins/hoster/BasketbuildCom.py +++ b/module/plugins/hoster/BasketbuildCom.py @@ -17,7 +17,7 @@ class BasketbuildCom(SimpleHoster): __pattern__ = r'https?://(?:www\.)?(?:\w\.)?basketbuild\.com/filedl/.+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] - __description__ = """basketbuild.com hoster plugin""" + __description__ = """Basketbuild.com hoster plugin""" __license__ = "GPLv3" __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de")] diff --git a/module/plugins/hoster/DevhostSt.py b/module/plugins/hoster/DevhostSt.py index e7a23f6b1..a8a031aaf 100644 --- a/module/plugins/hoster/DevhostSt.py +++ b/module/plugins/hoster/DevhostSt.py @@ -16,7 +16,7 @@ class DevhostSt(SimpleHoster): __pattern__ = r'http://(?:www\.)?d-h\.st/(?!users/)\w{3}' __config__ = [("use_premium", "bool", "Use premium account if available", True)] - __description__ = """d-h.st hoster plugin""" + __description__ = """D-h.st hoster plugin""" __license__ = "GPLv3" __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de")] diff --git a/module/plugins/hoster/FilesMailRu.py b/module/plugins/hoster/FilesMailRu.py index b24db62b0..66f715962 100644 --- a/module/plugins/hoster/FilesMailRu.py +++ b/module/plugins/hoster/FilesMailRu.py @@ -70,19 +70,25 @@ class FilesMailRu(Hoster): def prepare(self): - """You have to wait some seconds. Otherwise you will get a 40Byte HTML Page instead of the file you expected""" + """ + You have to wait some seconds. Otherwise you will get a 40Byte HTML Page instead of the file you expected + """ self.setWait(10) self.wait() return True def getFileUrl(self): - """gives you the URL to the file. Extracted from the Files.mail.ru HTML-page stored in self.html""" + """ + Gives you the URL to the file. Extracted from the Files.mail.ru HTML-page stored in self.html + """ return re.search(self.url_pattern, self.html).group(0).split('<a href="')[1].split('" onclick="return Act')[0] def getFileName(self): - """gives you the Name for each file. Also extracted from the HTML-Page""" + """ + Gives you the Name for each file. Also extracted from the HTML-Page + """ return re.search(self.url_pattern, self.html).group(0).split(', event)">')[1].split('</a>')[0] diff --git a/module/plugins/hoster/FreakshareCom.py b/module/plugins/hoster/FreakshareCom.py index 6532ba016..5abded2ac 100644 --- a/module/plugins/hoster/FreakshareCom.py +++ b/module/plugins/hoster/FreakshareCom.py @@ -92,7 +92,8 @@ class FreakshareCom(Hoster): def get_file_url(self): - """ returns the absolute downloadable filepath + """ + Returns the absolute downloadable filepath """ if not self.html: self.download_html() @@ -151,7 +152,8 @@ class FreakshareCom(Hoster): def file_exists(self): - """ returns True or False + """ + Returns True or False """ if not self.html: self.download_html() diff --git a/module/plugins/hoster/IfileIt.py b/module/plugins/hoster/IfileIt.py index ef267b505..18aa0b60f 100644 --- a/module/plugins/hoster/IfileIt.py +++ b/module/plugins/hoster/IfileIt.py @@ -11,7 +11,7 @@ class IfileIt(DeadHoster): __pattern__ = r'^unmatchable$' __config__ = [] #@TODO: Remove in 0.4.10 - __description__ = """Ifile.it""" + __description__ = """Ifile.it hoster plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] diff --git a/module/plugins/hoster/LolabitsEs.py b/module/plugins/hoster/LolabitsEs.py index 8ad811248..08773888b 100644 --- a/module/plugins/hoster/LolabitsEs.py +++ b/module/plugins/hoster/LolabitsEs.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -* -import HTMLParser import re from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.utils import html_unescape class LolabitsEs(SimpleHoster): @@ -43,7 +43,7 @@ class LolabitsEs(SimpleHoster): '__RequestVerificationToken' : token}, decode="unicode-escape") - self.link = HTMLParser.HTMLParser().unescape(re.search(self.LINK_PATTERN, self.html).group(1)) + self.link = html_unescape(re.search(self.LINK_PATTERN, self.html).group(1)) getInfo = create_getInfo(LolabitsEs) diff --git a/module/plugins/hoster/MegaCoNz.py b/module/plugins/hoster/MegaCoNz.py index 08eab2fb1..20b879aba 100644 --- a/module/plugins/hoster/MegaCoNz.py +++ b/module/plugins/hoster/MegaCoNz.py @@ -68,7 +68,9 @@ class MegaCoNz(Hoster): def getCipherKey(self, key): - """ Construct the cipher key from the given data """ + """ + Construct the cipher key from the given data + """ a = array.array("I", self.b64_decode(key)) k = array.array("I", (a[0] ^ a[4], a[1] ^ a[5], a[2] ^ a[6], a[3] ^ a[7])) @@ -79,8 +81,9 @@ class MegaCoNz(Hoster): def api_response(self, **kwargs): - """ Dispatch a call to the api, see https://mega.co.nz/#developers """ - + """ + Dispatch a call to the api, see https://mega.co.nz/#developers + """ # generate a session id, no idea where to obtain elsewhere uid = random.randint(10 << 9, 10 ** 10) @@ -103,8 +106,9 @@ class MegaCoNz(Hoster): def decryptFile(self, key): - """ Decrypts the file at lastDownload` """ - + """ + Decrypts the file at lastDownload` + """ # upper 64 bit of counter start n = self.b64_decode(key)[16:24] diff --git a/module/plugins/hoster/MegaDebridEu.py b/module/plugins/hoster/MegaDebridEu.py index 8c713bbb9..b83b80e46 100644 --- a/module/plugins/hoster/MegaDebridEu.py +++ b/module/plugins/hoster/MegaDebridEu.py @@ -15,7 +15,7 @@ class MegaDebridEu(MultiHoster): __pattern__ = r'http://((?:www\d+\.|s\d+\.)?mega-debrid\.eu|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/download/file/[\w^_]+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] - __description__ = """mega-debrid.eu multi-hoster plugin""" + __description__ = """Mega-debrid.eu multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("D.Ducatel", "dducatel@je-geek.fr")] diff --git a/module/plugins/hoster/MegacrypterCom.py b/module/plugins/hoster/MegacrypterCom.py index 10a2eb025..aea564ded 100644 --- a/module/plugins/hoster/MegacrypterCom.py +++ b/module/plugins/hoster/MegacrypterCom.py @@ -24,7 +24,9 @@ class MegacrypterCom(MegaCoNz): def api_response(self, **kwargs): - """ Dispatch a call to the api, see megacrypter.com/api_doc """ + """ + Dispatch a call to the api, see megacrypter.com/api_doc + """ self.logDebug("JSON request: " + json_dumps(kwargs)) res = self.load(self.API_URL, post=json_dumps(kwargs)) self.logDebug("API Response: " + res) diff --git a/module/plugins/hoster/MyvideoDe.py b/module/plugins/hoster/MyvideoDe.py index bc4d1ffeb..2194069f5 100644 --- a/module/plugins/hoster/MyvideoDe.py +++ b/module/plugins/hoster/MyvideoDe.py @@ -3,7 +3,7 @@ import re from module.plugins.internal.Hoster import Hoster -from module.unescape import unescape +from module.utils import html_unescape class MyvideoDe(Hoster): @@ -38,7 +38,7 @@ class MyvideoDe(Hoster): def get_file_name(self): file_name_pattern = r'<h1 class=\'globalHd\'>(.*)</h1>' - return unescape(re.search(file_name_pattern, self.html).group(1).replace("/", "") + '.flv') + return html_unescape(re.search(file_name_pattern, self.html).group(1).replace("/", "") + '.flv') def file_exists(self): diff --git a/module/plugins/hoster/OboomCom.py b/module/plugins/hoster/OboomCom.py index ae51d4b5a..e2a9c114a 100644 --- a/module/plugins/hoster/OboomCom.py +++ b/module/plugins/hoster/OboomCom.py @@ -17,7 +17,7 @@ class OboomCom(Hoster): __pattern__ = r'https?://(?:www\.)?oboom\.com/(?:#(?:id=|/)?)?(?P<ID>\w{8})' - __description__ = """oboom.com hoster plugin""" + __description__ = """Oboom.com hoster plugin""" __license__ = "GPLv3" __authors__ = [("stanley", "stanley.foerster@gmail.com")] diff --git a/module/plugins/hoster/PornhostCom.py b/module/plugins/hoster/PornhostCom.py index a8bbfdb80..55e04e5f6 100644 --- a/module/plugins/hoster/PornhostCom.py +++ b/module/plugins/hoster/PornhostCom.py @@ -33,7 +33,8 @@ class PornhostCom(Hoster): def get_file_url(self): - """ returns the absolute downloadable filepath + """ + Returns the absolute downloadable filepath """ if not self.html: self.download_html() @@ -68,7 +69,8 @@ class PornhostCom(Hoster): def file_exists(self): - """ returns True or False + """ + Returns True or False """ if not self.html: self.download_html() diff --git a/module/plugins/hoster/PornhubCom.py b/module/plugins/hoster/PornhubCom.py index 0c7e3671e..857bb404c 100644 --- a/module/plugins/hoster/PornhubCom.py +++ b/module/plugins/hoster/PornhubCom.py @@ -32,7 +32,8 @@ class PornhubCom(Hoster): def get_file_url(self): - """ returns the absolute downloadable filepath + """ + Returns the absolute downloadable filepath """ if not self.html: self.download_html() @@ -78,7 +79,8 @@ class PornhubCom(Hoster): def file_exists(self): - """ returns True or False + """ + Returns True or False """ if not self.html: self.download_html() diff --git a/module/plugins/hoster/RedtubeCom.py b/module/plugins/hoster/RedtubeCom.py index 3915b1421..15ce3b2b1 100644 --- a/module/plugins/hoster/RedtubeCom.py +++ b/module/plugins/hoster/RedtubeCom.py @@ -3,7 +3,7 @@ import re from module.plugins.internal.Hoster import Hoster -from module.unescape import unescape +from module.utils import html_unescape class RedtubeCom(Hoster): @@ -33,14 +33,13 @@ class RedtubeCom(Hoster): def get_file_url(self): - """ returns the absolute downloadable filepath + """ + Returns the absolute downloadable filepath """ if not self.html: self.download_html() - file_url = unescape(re.search(r'hashlink=(http.*?)"', self.html).group(1)) - - return file_url + return html_unescape(re.search(r'hashlink=(http.*?)"', self.html).group(1)) def get_file_name(self): @@ -51,7 +50,8 @@ class RedtubeCom(Hoster): def file_exists(self): - """ returns True or False + """ + Returns True or False """ if not self.html: self.download_html() diff --git a/module/plugins/hoster/ShareplaceCom.py b/module/plugins/hoster/ShareplaceCom.py index 9e27aea1e..47ad05a8c 100644 --- a/module/plugins/hoster/ShareplaceCom.py +++ b/module/plugins/hoster/ShareplaceCom.py @@ -55,7 +55,8 @@ class ShareplaceCom(Hoster): def get_file_url(self): - """ returns the absolute downloadable filepath + """ + Returns the absolute downloadable filepath """ url = re.search(r"var beer = '(.*?)';", self.html) if url: @@ -77,7 +78,8 @@ class ShareplaceCom(Hoster): def file_exists(self): - """ returns True or False + """ + Returns True or False """ if not self.html: self.download_html() diff --git a/module/plugins/hoster/VeehdCom.py b/module/plugins/hoster/VeehdCom.py index cd7572dd3..11c70ebff 100644 --- a/module/plugins/hoster/VeehdCom.py +++ b/module/plugins/hoster/VeehdCom.py @@ -68,7 +68,8 @@ class VeehdCom(Hoster): def get_file_url(self): - """ returns the absolute downloadable filepath + """ + Returns the absolute downloadable filepath """ if not self.html: self.download_html() diff --git a/module/plugins/hoster/XHamsterCom.py b/module/plugins/hoster/XHamsterCom.py index 2d742cfa8..d9441d792 100644 --- a/module/plugins/hoster/XHamsterCom.py +++ b/module/plugins/hoster/XHamsterCom.py @@ -47,7 +47,8 @@ class XHamsterCom(Hoster): def get_file_url(self): - """ returns the absolute downloadable filepath + """ + Returns the absolute downloadable filepath """ if not self.html: self.download_html() @@ -118,7 +119,8 @@ class XHamsterCom(Hoster): def file_exists(self): - """ returns True or False + """ + Returns True or False """ if not self.html: self.download_html() diff --git a/module/plugins/hoster/Xdcc.py b/module/plugins/hoster/Xdcc.py index efe3b6d6b..20f800967 100644 --- a/module/plugins/hoster/Xdcc.py +++ b/module/plugins/hoster/Xdcc.py @@ -189,7 +189,7 @@ class Xdcc(Hoster): self.pyfile.name = packname - download_folder = self.core.config['general']['download_folder'] + download_folder = self.core.config.get("general", "download_folder") filename = fs_join(download_folder, packname) self.logInfo(_("Downloading %s from %s:%d") % (packname, ip, port)) diff --git a/module/plugins/hoster/YoupornCom.py b/module/plugins/hoster/YoupornCom.py index 615b10d65..fa40714c6 100644 --- a/module/plugins/hoster/YoupornCom.py +++ b/module/plugins/hoster/YoupornCom.py @@ -33,7 +33,8 @@ class YoupornCom(Hoster): def get_file_url(self): - """ returns the absolute downloadable filepath + """ + Returns the absolute downloadable filepath """ if not self.html: self.download_html() @@ -50,7 +51,8 @@ class YoupornCom(Hoster): def file_exists(self): - """ returns True or False + """ + Returns True or False """ if not self.html: self.download_html() diff --git a/module/plugins/hoster/YourfilesTo.py b/module/plugins/hoster/YourfilesTo.py index 4d316eabf..f64ac1a43 100644 --- a/module/plugins/hoster/YourfilesTo.py +++ b/module/plugins/hoster/YourfilesTo.py @@ -56,7 +56,8 @@ class YourfilesTo(Hoster): def get_file_url(self): - """ returns the absolute downloadable filepath + """ + Returns the absolute downloadable filepath """ url = re.search(r"var bla = '(.*?)';", self.html) if url: @@ -75,7 +76,8 @@ class YourfilesTo(Hoster): def file_exists(self): - """ returns True or False + """ + Returns True or False """ if not self.html: self.download_html() diff --git a/module/plugins/hoster/YoutubeCom.py b/module/plugins/hoster/YoutubeCom.py index e53a66d00..b2696ddfb 100644 --- a/module/plugins/hoster/YoutubeCom.py +++ b/module/plugins/hoster/YoutubeCom.py @@ -11,9 +11,10 @@ from module.utils import html_unescape def which(program): - """Works exactly like the unix command which - Courtesy of http://stackoverflow.com/a/377028/675646""" - + """ + Works exactly like the unix command which + Courtesy of http://stackoverflow.com/a/377028/675646 + """ isExe = lambda x: os.path.isfile(x) and os.access(x, os.X_OK) fpath, fname = os.path.split(program) |