diff options
Diffstat (limited to 'module/plugins/hoster')
39 files changed, 124 insertions, 124 deletions
diff --git a/module/plugins/hoster/BezvadataCz.py b/module/plugins/hoster/BezvadataCz.py index 91d7e68b8..af3fb97f3 100644 --- a/module/plugins/hoster/BezvadataCz.py +++ b/module/plugins/hoster/BezvadataCz.py @@ -29,13 +29,13 @@ class BezvadataCz(SimpleHoster): def handle_free(self, pyfile): - # download button + #: Download button m = re.search(r'<a class="stahnoutSoubor".*?href="(.*?)"', self.html) if m is None: self.error(_("Page 1 URL not found")) url = "http://bezvadata.cz%s" % m.group(1) - # captcha form + #: Captcha form self.html = self.load(url) self.check_errors() for _i in xrange(5): @@ -47,7 +47,7 @@ class BezvadataCz(SimpleHoster): if m is None: self.error(_("Wrong captcha image")) - # captcha image is contained in html page as base64encoded data but decryptCaptcha() expects image url + #: Captcha image is contained in html page as base64encoded data but decryptCaptcha() expects image url self.load, proper_load = self.loadcaptcha, self.load try: inputs['captcha'] = self.decrypt_captcha(m.group(1), imgtype='png') @@ -62,7 +62,7 @@ class BezvadataCz(SimpleHoster): else: self.fail(_("No valid captcha code entered")) - # download url + #: Download url self.html = self.load("http://bezvadata.cz%s" % action, post=inputs) self.check_errors() m = re.search(r'<a class="stahnoutSoubor2" href="(.*?)">', self.html) @@ -71,7 +71,7 @@ class BezvadataCz(SimpleHoster): url = "http://bezvadata.cz%s" % m.group(1) self.log_debug("DL URL %s" % url) - # countdown + #: countdown m = re.search(r'id="countdown">(\d\d):(\d\d)<', self.html) wait_time = (int(m.group(1)) * 60 + int(m.group(2))) if m else 120 self.wait(wait_time, False) @@ -81,7 +81,7 @@ class BezvadataCz(SimpleHoster): def check_errors(self): if 'images/button-download-disable.png' in self.html: - self.wait(5 * 60, 24, _("Download limit reached")) #: parallel dl limit + self.wait(5 * 60, 24, _("Download limit reached")) #: Parallel dl limit elif '<div class="infobox' in self.html: self.temp_offline() else: diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index d44b4046f..49857ed84 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -40,7 +40,7 @@ class CzshareCom(SimpleHoster): def check_traffic_left(self): - #: check if user logged in + #: Check if user logged in m = re.search(self.USER_CREDIT_PATTERN, self.html) if m is None: self.account.relogin(self.user) @@ -49,7 +49,7 @@ class CzshareCom(SimpleHoster): if m is None: return False - #: check user credit + #: Check user credit try: credit = parse_size(m.group(1).replace(' ', ''), m.group(2)) self.log_info(_("Premium download for %i KiB of Credit") % (self.pyfile.size / 1024)) @@ -65,7 +65,7 @@ class CzshareCom(SimpleHoster): def handle_premium(self, pyfile): - #: parse download link + #: Parse download link try: form = re.search(self.PREMIUM_FORM_PATTERN, self.html, re.S).group(1) inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form)) @@ -73,12 +73,12 @@ class CzshareCom(SimpleHoster): self.log_error(e) self.reset_account() - #: download the file, destination is determined by pyLoad + #: Download the file, destination is determined by pyLoad self.download("http://sdilej.cz/profi_down.php", post=inputs, disposition=True) def handle_free(self, pyfile): - #: get free url + #: Get free url m = re.search(self.FREE_URL_PATTERN, self.html) if m is None: self.error(_("FREE_URL_PATTERN not found")) @@ -87,7 +87,7 @@ class CzshareCom(SimpleHoster): self.log_debug("PARSED_URL:" + parsed_url) - #: get download ticket and parse html + #: Get download ticket and parse html self.html = self.load(parsed_url) if re.search(self.MULTIDL_PATTERN, self.html): self.wait(5 * 60, 12, _("Download limit reached")) @@ -101,7 +101,7 @@ class CzshareCom(SimpleHoster): self.log_error(e) self.error(_("Form")) - #: get and decrypt captcha + #: Get and decrypt captcha captcha_url = 'http://sdilej.cz/captcha.php' for _i in xrange(5): inputs['captchastring2'] = self.decrypt_captcha(captcha_url) @@ -122,7 +122,7 @@ class CzshareCom(SimpleHoster): m = re.search("countdown_number = (\d+);", self.html) self.set_wait(int(m.group(1)) if m else 50) - #: download the file, destination is determined by pyLoad + #: Download the file, destination is determined by pyLoad self.log_debug("WAIT URL", self.req.lastEffectiveURL) m = re.search("free_wait.php\?server=(.*?)&(.*)", self.req.lastEffectiveURL) @@ -135,7 +135,7 @@ class CzshareCom(SimpleHoster): def check_file(self): - #: check download + #: Check download check = self.check_download({ "temp offline" : re.compile(r"^Soubor je do.*asn.* nedostupn.*$"), "credit" : re.compile(r"^Nem.*te dostate.*n.* kredit.$"), diff --git a/module/plugins/hoster/DlFreeFr.py b/module/plugins/hoster/DlFreeFr.py index dd3325f0f..7db72b383 100644 --- a/module/plugins/hoster/DlFreeFr.py +++ b/module/plugins/hoster/DlFreeFr.py @@ -111,7 +111,7 @@ class DlFreeFr(SimpleHoster): def get_last_headers(self): - # parse header + #: Parse header header = {"code": self.req.code} for line in self.req.http.header.splitlines(): line = line.strip() diff --git a/module/plugins/hoster/FileSharkPl.py b/module/plugins/hoster/FileSharkPl.py index 595d0c7ed..3a818e02e 100644 --- a/module/plugins/hoster/FileSharkPl.py +++ b/module/plugins/hoster/FileSharkPl.py @@ -47,7 +47,7 @@ class FileSharkPl(SimpleHoster): def check_errors(self): - #: check if file is now available for download (-> file name can be found in html body) + #: Check if file is now available for download (-> file name can be found in html body) m = re.search(self.WAIT_PATTERN, self.html) if m: errmsg = self.info['error'] = _("Another download already run") diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py index 30ea6a869..3731fad43 100644 --- a/module/plugins/hoster/FilepostCom.py +++ b/module/plugins/hoster/FilepostCom.py @@ -93,10 +93,10 @@ class FilepostCom(SimpleHoster): if not 'js' in res: self.error(_("JSON %s 1") % field) - #: i changed js_answer to res['js'] since js_answer is nowhere set. - #: i don't know the JSON-HTTP specs in detail, but the previous author - #: accessed res['js']['error'] as well as js_answer['error']. - #: see the two lines commented out with "# ~?". + #: I changed js_answer to res['js'] since js_answer is nowhere set. + #: I don't know the JSON-HTTP specs in detail, but the previous author + #: Accessed res['js']['error'] as well as js_answer['error']. + #: See the two lines commented out with "# ~?". if 'error' in res['js']: if res['js']['error'] == 'download_delay': diff --git a/module/plugins/hoster/FilesMailRu.py b/module/plugins/hoster/FilesMailRu.py index df6b8a2ad..dfd4372a5 100644 --- a/module/plugins/hoster/FilesMailRu.py +++ b/module/plugins/hoster/FilesMailRu.py @@ -49,17 +49,17 @@ class FilesMailRu(Hoster): self.html = self.load(pyfile.url) self.url_pattern = '<a href="(.+?)" onclick="return Act\(this\, \'dlink\'\, event\)">(.+?)</a>' - # marks the file as "offline" when the pattern was found on the html-page''' + #: Marks the file as "offline" when the pattern was found on the html-page''' if r'<div class="errorMessage mb10">' in self.html: self.offline() elif r'Page cannot be displayed' in self.html: self.offline() - # the filename that will be showed in the list (e.g. test.part1.rar)''' + #: The filename that will be showed in the list (e.g. test.part1.rar)''' pyfile.name = self.get_file_name() - # prepare and download''' + #: Prepare and download''' if not self.account: self.prepare() self.download(self.get_file_url()) @@ -92,7 +92,7 @@ class FilesMailRu(Hoster): def my_post_process(self): - #: searches the file for HTMl-Code. Sometimes the Redirect + #: Searches the file for HTMl-Code. Sometimes the Redirect #: doesn't work (maybe a curl Problem) and you get only a small #: HTML file and the Download is marked as "finished" #: then the download will be restarted. It's only bad for these diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index f38de699e..fd50bd265 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -108,13 +108,13 @@ class FileserveCom(Hoster): else: self.error(_("Unknown server response")) - #: show download link + #: Show download link res = self.load(self.url, post={"downloadLink": "show"}) self.log_debug("Show downloadLink response: %s" % res) if "fail" in res: self.error(_("Couldn't retrieve download url")) - #: this may either download our file or forward us to an error page + #: This may either download our file or forward us to an error page self.download(self.url, post={"download": "normal"}) self.log_debug(self.req.http.lastEffectiveURL) @@ -183,7 +183,7 @@ class FileserveCom(Hoster): def handle_premium(self): premium_url = None if self.__name__ == "FileserveCom": - # try api download + #: Try api download res = self.load("http://app.fileserve.com/api/download/premium/", post={"username": self.user, "password": self.account.get_account_data(self.user)['password'], diff --git a/module/plugins/hoster/FlyFilesNet.py b/module/plugins/hoster/FlyFilesNet.py index 28c4ce813..ed46833a5 100644 --- a/module/plugins/hoster/FlyFilesNet.py +++ b/module/plugins/hoster/FlyFilesNet.py @@ -30,7 +30,7 @@ class FlyFilesNet(SimpleHoster): url = "http://flyfiles.net" - #: get download URL + #: Get download URL parsed_url = self.load(url, post={"getDownLink": session}) self.log_debug("Parsed URL: %s" % parsed_url) diff --git a/module/plugins/hoster/FreakshareCom.py b/module/plugins/hoster/FreakshareCom.py index 135315197..f5092eceb 100644 --- a/module/plugins/hoster/FreakshareCom.py +++ b/module/plugins/hoster/FreakshareCom.py @@ -97,7 +97,7 @@ class FreakshareCom(Hoster): if not self.html: self.download_html() if not self.want_reconnect: - self.req_opts = self.get_download_options() #: get the Post options for the Request + self.req_opts = self.get_download_options() #: Get the Post options for the Request # file_url = self.pyfile.url # return file_url else: @@ -164,11 +164,11 @@ class FreakshareCom(Hoster): def get_download_options(self): re_envelope = re.search(r".*?value=\"Free\sDownload\".*?\n*?(.*?<.*?>\n*)*?\n*\s*?</form>", - self.html).group(0) #: get the whole request + self.html).group(0) #: Get the whole request to_sort = re.findall(r"<input\stype=\"hidden\"\svalue=\"(.*?)\"\sname=\"(.*?)\"\s\/>", re_envelope) request_options = dict((n, v) for (v, n) in to_sort) - herewego = self.load(self.pyfile.url, None, request_options) #: the actual download-Page + herewego = self.load(self.pyfile.url, None, request_options) #: The actual download-Page to_sort = re.findall(r"<input\stype=\".*?\"\svalue=\"(\S*?)\".*?name=\"(\S*?)\"\s.*?\/>", herewego) request_options = dict((n, v) for (v, n) in to_sort) diff --git a/module/plugins/hoster/FreeWayMe.py b/module/plugins/hoster/FreeWayMe.py index 0f264dd49..3055d655a 100644 --- a/module/plugins/hoster/FreeWayMe.py +++ b/module/plugins/hoster/FreeWayMe.py @@ -27,7 +27,7 @@ class FreeWayMe(MultiHoster): user, data = self.account.select_account() for _i in xrange(5): - #: try it five times + #: Try it five times header = self.load("http://www.free-way.bz/load.php", #@TODO: Revert to `https` in 0.4.10 get={'multiget': 7, 'url' : pyfile.url, @@ -39,14 +39,14 @@ class FreeWayMe(MultiHoster): if 'location' in header: headers = self.load(header['location'], just_header=True) if headers['code'] == 500: - #: error on 2nd stage + #: Error on 2nd stage self.log_error(_("Error [stage2]")) else: - #: seems to work.. + #: Seems to work.. self.download(header['location']) break else: - #: error page first stage + #: Error page first stage self.log_error(_("Error [stage1]")) #@TODO: handle errors diff --git a/module/plugins/hoster/Ftp.py b/module/plugins/hoster/Ftp.py index 2accf9883..685e7ce87 100644 --- a/module/plugins/hoster/Ftp.py +++ b/module/plugins/hoster/Ftp.py @@ -63,7 +63,7 @@ class Ftp(Hoster): pyfile.size = int(m.group(1)) self.download(pyfile.url) else: - # Naive ftp directory listing + #: Naive ftp directory listing if re.search(r'^25\d.*?"', self.req.http.header, re.M): pyfile.url = pyfile.url.rstrip('/') pkgname = "/".join([pyfile.package().name, urlparse.urlparse(pyfile.url).path.rpartition('/')[2]]) diff --git a/module/plugins/hoster/Keep2ShareCc.py b/module/plugins/hoster/Keep2ShareCc.py index c743f4fc9..7e34550d9 100644 --- a/module/plugins/hoster/Keep2ShareCc.py +++ b/module/plugins/hoster/Keep2ShareCc.py @@ -55,7 +55,7 @@ class Keep2ShareCc(SimpleHoster): if m: self.log_debug("Hoster told us to wait for %s" % m.group(1)) - #: string to time convert courtesy of https://stackoverflow.com/questions/10663720 + #: String to time convert courtesy of https://stackoverflow.com/questions/10663720 ftr = [3600, 60, 1] wait_time = sum(a * b for a, b in zip(ftr, map(int, m.group(1).split(':')))) @@ -69,8 +69,8 @@ class Keep2ShareCc(SimpleHoster): self.fid = re.search(r'<input type="hidden" name="slow_id" value="(.+?)">', self.html).group(1) self.html = self.load(pyfile.url, post={'yt0': '', 'slow_id': self.fid}) - #: self.log_debug(self.fid) - #: self.log_debug(pyfile.url) + # self.log_debug(self.fid) + # self.log_debug(pyfile.url) self.check_errors() diff --git a/module/plugins/hoster/LuckyShareNet.py b/module/plugins/hoster/LuckyShareNet.py index 4f10b8eed..f63a222df 100644 --- a/module/plugins/hoster/LuckyShareNet.py +++ b/module/plugins/hoster/LuckyShareNet.py @@ -40,7 +40,7 @@ class LuckyShareNet(SimpleHoster): #@TODO: There should be a filesize limit for free downloads - # Some files could not be downloaded in free mode + #: Some files could not be downloaded in free mode def handle_free(self, pyfile): rep = self.load(r"http://luckyshare.net/download/request/type/time/file/" + self.info['pattern']['ID']) diff --git a/module/plugins/hoster/MegaCoNz.py b/module/plugins/hoster/MegaCoNz.py index 411c12c4a..9a2726448 100644 --- a/module/plugins/hoster/MegaCoNz.py +++ b/module/plugins/hoster/MegaCoNz.py @@ -84,7 +84,7 @@ class MegaCoNz(Hoster): """ Dispatch a call to the api, see https://mega.co.nz/#developers """ - #: generate a session id, no idea where to obtain elsewhere + #: Generate a session id, no idea where to obtain elsewhere uid = random.randint(10 << 9, 10 ** 10) res = self.load(self.API_URL, get={'id': uid}, post=json_dumps([kwargs])) @@ -109,10 +109,10 @@ class MegaCoNz(Hoster): """ Decrypts the file at lastDownload` """ - #: upper 64 bit of counter start + #: Upper 64 bit of counter start n = self.b64_decode(key)[16:24] - #: convert counter to long and shift bytes + #: Convert counter to long and shift bytes k, iv, meta_mac = self.get_cipher_key(key) ctr = Counter.new(128, initial_value=long(n.encode("hex"), 16) << 64) cipher = AES.new(k, AES.MODE_CTR, counter=ctr) @@ -130,8 +130,8 @@ class MegaCoNz(Hoster): except IOError, e: self.fail(e) - chunk_size = 2 ** 15 #: buffer size, 32k - #: file_mac = [0, 0, 0, 0] # calculate CBC-MAC for checksum + chunk_size = 2 ** 15 #: Buffer size, 32k + # file_mac = [0, 0, 0, 0] # calculate CBC-MAC for checksum chunks = os.path.getsize(file_crypted) / chunk_size + 1 for i in xrange(chunks): @@ -144,27 +144,27 @@ class MegaCoNz(Hoster): self.pyfile.setProgress(int((100.0 / chunks) * i)) - #: chunk_mac = [iv[0], iv[1], iv[0], iv[1]] - #: for i in xrange(0, chunk_size, 16): - #: block = chunk[i:i+16] - #: if len(block) % 16: - #: block += '=' * (16 - (len(block) % 16)) - #: block = array.array("I", block) + # chunk_mac = [iv[0], iv[1], iv[0], iv[1]] + # for i in xrange(0, chunk_size, 16): + # block = chunk[i:i+16] + # if len(block) % 16: + # block += '=' * (16 - (len(block) % 16)) + # block = array.array("I", block) - #: chunk_mac = [chunk_mac[0] ^ a_[0], chunk_mac[1] ^ block[1], chunk_mac[2] ^ block[2], chunk_mac[3] ^ block[3]] - #: chunk_mac = aes_cbc_encrypt_a32(chunk_mac, k) + # chunk_mac = [chunk_mac[0] ^ a_[0], chunk_mac[1] ^ block[1], chunk_mac[2] ^ block[2], chunk_mac[3] ^ block[3]] + # chunk_mac = aes_cbc_encrypt_a32(chunk_mac, k) - #: file_mac = [file_mac[0] ^ chunk_mac[0], file_mac[1] ^ chunk_mac[1], file_mac[2] ^ chunk_mac[2], file_mac[3] ^ chunk_mac[3]] - #: file_mac = aes_cbc_encrypt_a32(file_mac, k) + # file_mac = [file_mac[0] ^ chunk_mac[0], file_mac[1] ^ chunk_mac[1], file_mac[2] ^ chunk_mac[2], file_mac[3] ^ chunk_mac[3]] + # file_mac = aes_cbc_encrypt_a32(file_mac, k) self.pyfile.setProgress(100) f.close() df.close() - #: if file_mac[0] ^ file_mac[1], file_mac[2] ^ file_mac[3] != meta_mac: - #: os.remove(file_decrypted) - #: self.fail(_("Checksum mismatch")) + # if file_mac[0] ^ file_mac[1], file_mac[2] ^ file_mac[3] != meta_mac: + # os.remove(file_decrypted) + # self.fail(_("Checksum mismatch")) os.remove(file_crypted) self.last_download = fs_decode(file_decrypted) @@ -194,8 +194,8 @@ class MegaCoNz(Hoster): self.log_debug("ID: %s" % id, "Key: %s" % key, "Type: %s" % ("public" if public else "node")) - #: g is for requesting a download url - #: this is similar to the calls in the mega js app, documentation is very bad + #: G is for requesting a download url + #: This is similar to the calls in the mega js app, documentation is very bad if public: mega = self.api_response(a="g", g=1, p=id, ssl=1)[0] else: @@ -211,7 +211,7 @@ class MegaCoNz(Hoster): pyfile.name = attr['n'] + self.FILE_SUFFIX pyfile.size = mega['s'] - #: self.req.http.c.setopt(pycurl.SSL_CIPHER_LIST, "RC4-MD5:DEFAULT") + # self.req.http.c.setopt(pycurl.SSL_CIPHER_LIST, "RC4-MD5:DEFAULT") self.download(mega['g']) diff --git a/module/plugins/hoster/MegacrypterCom.py b/module/plugins/hoster/MegacrypterCom.py index 7152a1cbc..e3d1c9b9e 100644 --- a/module/plugins/hoster/MegacrypterCom.py +++ b/module/plugins/hoster/MegacrypterCom.py @@ -34,18 +34,18 @@ class MegacrypterCom(MegaCoNz): def process(self, pyfile): - #: match is guaranteed because plugin was chosen to handle url + #: Match is guaranteed because plugin was chosen to handle url node = re.match(self.__pattern__, pyfile.url).group(0) #: get Mega.co.nz link info info = self.api_response(link=node, m="info") - #: get crypted file URL + #: Get crypted file URL dl = self.api_response(link=node, m="dl") #@TODO: map error codes, implement password protection - # if info['pass'] is True: - # crypted_file_key, md5_file_key = info['key'].split("#") + # if info['pass'] is True: + # crypted_file_key, md5_file_key = info['key'].split("#") key = self.b64_decode(info['key']) diff --git a/module/plugins/hoster/NitroflareCom.py b/module/plugins/hoster/NitroflareCom.py index f60a9c2e2..cd149c5b8 100644 --- a/module/plugins/hoster/NitroflareCom.py +++ b/module/plugins/hoster/NitroflareCom.py @@ -32,7 +32,7 @@ class NitroflareCom(SimpleHoster): def handle_free(self, pyfile): - #: used here to load the cookies which will be required later + #: Used here to load the cookies which will be required later self.load(pyfile.url, post={'goToFreePage': ""}) self.load("http://nitroflare.com/ajax/setCookie.php", post={'fileId': self.info['pattern']['ID']}) diff --git a/module/plugins/hoster/NoPremiumPl.py b/module/plugins/hoster/NoPremiumPl.py index 65170ca10..76523361c 100644 --- a/module/plugins/hoster/NoPremiumPl.py +++ b/module/plugins/hoster/NoPremiumPl.py @@ -79,10 +79,10 @@ class NoPremiumPl(MultiHoster): if "errno" in parsed.keys(): if parsed['errno'] in self.ERROR_CODES: - #: error code in known + #: Error code in known self.fail(self.ERROR_CODES[parsed['errno']] % self.__name__) else: - #: error code isn't yet added to plugin + #: Error code isn't yet added to plugin self.fail( parsed['errstring'] or _("Unknown error (code: %s)") % parsed['errno'] diff --git a/module/plugins/hoster/OboomCom.py b/module/plugins/hoster/OboomCom.py index 37dce3750..307f34d66 100644 --- a/module/plugins/hoster/OboomCom.py +++ b/module/plugins/hoster/OboomCom.py @@ -99,7 +99,7 @@ class OboomCom(Hoster): self.retry(5, 15 * 60, _("Service unavailable")) elif result[0] == 403: - if result[1] == -1: #: another download is running + if result[1] == -1: #: Another download is running self.set_wait(15 * 60) else: self.set_wait(result[1], True) diff --git a/module/plugins/hoster/PornhubCom.py b/module/plugins/hoster/PornhubCom.py index ad0eebb28..804a31130 100644 --- a/module/plugins/hoster/PornhubCom.py +++ b/module/plugins/hoster/PornhubCom.py @@ -40,7 +40,7 @@ class PornhubCom(Hoster): url = "http://www.pornhub.com//gateway.php" video_id = self.pyfile.url.split('=')[-1] - #: thanks to jD team for this one v + #: Thanks to jD team for this one v post_data = "\x00\x03\x00\x00\x00\x01\x00\x0c\x70\x6c\x61\x79\x65\x72\x43\x6f\x6e\x66\x69\x67\x00\x02\x2f\x31\x00\x00\x00\x44\x0a\x00\x00\x00\x03\x02\x00" post_data += chr(len(video_id)) post_data += video_id diff --git a/module/plugins/hoster/PremiumTo.py b/module/plugins/hoster/PremiumTo.py index aeeef2847..f16fde1e0 100644 --- a/module/plugins/hoster/PremiumTo.py +++ b/module/plugins/hoster/PremiumTo.py @@ -28,7 +28,7 @@ class PremiumTo(MultiHoster): def handle_premium(self, pyfile): - # raise timeout to 2min + #: Raise timeout to 2 min self.download("http://premium.to/api/getfile.php", get={'username': self.account.username, 'password': self.account.password, diff --git a/module/plugins/hoster/PremiumizeMe.py b/module/plugins/hoster/PremiumizeMe.py index f02cc4c66..36d1f3feb 100644 --- a/module/plugins/hoster/PremiumizeMe.py +++ b/module/plugins/hoster/PremiumizeMe.py @@ -20,7 +20,7 @@ class PremiumizeMe(MultiHoster): def handle_premium(self, pyfile): #: In some cases hostsers do not supply us with a filename at download, so we - #: are going to set a fall back filename (e.g. for freakshare or xfileshare) + #: Are going to set a fall back filename (e.g. for freakshare or xfileshare) pyfile.name = pyfile.name.split('/').pop() #: Remove everthing before last slash #: Correction for automatic assigned filename: Removing html at end if needed diff --git a/module/plugins/hoster/PromptfileCom.py b/module/plugins/hoster/PromptfileCom.py index ddfce8e19..e01da0949 100644 --- a/module/plugins/hoster/PromptfileCom.py +++ b/module/plugins/hoster/PromptfileCom.py @@ -26,7 +26,7 @@ class PromptfileCom(SimpleHoster): def handle_free(self, pyfile): - # STAGE 1: get link to continue + #: STAGE 1: get link to continue m = re.search(self.CHASH_PATTERN, self.html) if m is None: self.error(_("CHASH_PATTERN not found")) @@ -34,10 +34,10 @@ class PromptfileCom(SimpleHoster): chash = m.group(1) self.log_debug("Read chash %s" % chash) - #: continue to stage2 + #: Continue to stage2 self.html = self.load(pyfile.url, post={'chash': chash}) - # STAGE 2: get the direct link + #: STAGE 2: get the direct link return super(PromptfileCom, self).handle_free(pyfile) diff --git a/module/plugins/hoster/QuickshareCz.py b/module/plugins/hoster/QuickshareCz.py index e9cfdb085..2d36f45a9 100644 --- a/module/plugins/hoster/QuickshareCz.py +++ b/module/plugins/hoster/QuickshareCz.py @@ -28,12 +28,12 @@ class QuickshareCz(SimpleHoster): self.html = self.load(pyfile.url) self.getFileInfo() - #: parse js variables + #: Parse js variables self.jsvars = dict((x, y.strip("'")) for x, y in re.findall(r"var (\w+) = ([\d.]+|'.+?')", self.html)) self.log_debug(self.jsvars) pyfile.name = self.jsvars['ID3'] - #: determine download type - free or premium + #: Determine download type - free or premium if self.premium: if 'UU_prihlasen' in self.jsvars: if self.jsvars['UU_prihlasen'] == '0': @@ -54,7 +54,7 @@ class QuickshareCz(SimpleHoster): def handle_free(self, pyfile): - #: get download url + #: Get download url download_url = '%s/download.php' % self.jsvars['server'] data = dict((x, self.jsvars[x]) for x in self.jsvars if x in ("ID1", "ID2", "ID3", "ID4")) self.log_debug("FREE URL1:" + download_url, data) @@ -71,7 +71,7 @@ class QuickshareCz(SimpleHoster): self.link = m.group(1).rstrip() #@TODO: Remove .rstrip() in 0.4.10 self.log_debug("FREE URL2:" + self.link) - #: check errors + #: Check errors m = re.search(r'/chyba/(\d+)', self.link) if m: if m.group(1) == '1': diff --git a/module/plugins/hoster/RPNetBiz.py b/module/plugins/hoster/RPNetBiz.py index a449ed276..b6e54a560 100644 --- a/module/plugins/hoster/RPNetBiz.py +++ b/module/plugins/hoster/RPNetBiz.py @@ -35,14 +35,14 @@ class RPNetBiz(MultiHoster): "links" : pyfile.url}) self.log_debug("JSON data: %s" % res) - link_status = json_loads(res)['links'][0] #: get the first link... since we only queried one + link_status = json_loads(res)['links'][0] #: Get the first link... since we only queried one #: Check if we only have an id as a HDD link if 'id' in link_status: self.log_debug("Need to wait at least 30 seconds before requery") - self.wait(30) #: wait for 30 seconds + self.wait(30) #: Wait for 30 seconds #: Lets query the server again asking for the status on the link, - #: we need to keep doing this until we reach 100 + #: We need to keep doing this until we reach 100 max_tries = 30 my_try = 0 while (my_try <= max_tries): diff --git a/module/plugins/hoster/RapideoPl.py b/module/plugins/hoster/RapideoPl.py index 9b893f7a3..804fcf42a 100644 --- a/module/plugins/hoster/RapideoPl.py +++ b/module/plugins/hoster/RapideoPl.py @@ -79,10 +79,10 @@ class RapideoPl(MultiHoster): if "errno" in parsed.keys(): if parsed['errno'] in self.ERROR_CODES: - #: error code in known + #: Error code in known self.fail(self.ERROR_CODES[parsed['errno']] % self.__name__) else: - #: error code isn't yet added to plugin + #: Error code isn't yet added to plugin self.fail( parsed['errstring'] or _("Unknown error (code: %s)") % parsed['errno'] diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index 53b3d4ae8..da1509c94 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -48,7 +48,7 @@ class ShareonlineBiz(SimpleHoster): info['fileid'] = field[0] info['status'] = 2 info['name'] = field[2] - info['size'] = field[3] #: in bytes + info['size'] = field[3] #: In bytes info['md5'] = field[4].strip().lower().replace("\n\n", "") #: md5 elif field[1] in ("DELETED", "NOT FOUND"): @@ -120,7 +120,7 @@ class ShareonlineBiz(SimpleHoster): return super(ShareonlineBiz, self).checkFile() - def handle_premium(self, pyfile): #: should be working better loading (account) api internally + def handle_premium(self, pyfile): #: Should be working better loading (account) api internally html = self.load("http://api.share-online.biz/account.php", get={'username': self.user, 'password': self.account.get_account_data(self.user)['password'], diff --git a/module/plugins/hoster/ShareplaceCom.py b/module/plugins/hoster/ShareplaceCom.py index caafe7952..6e750721e 100644 --- a/module/plugins/hoster/ShareplaceCom.py +++ b/module/plugins/hoster/ShareplaceCom.py @@ -37,7 +37,7 @@ class ShareplaceCom(Hoster): if not self.html: self.download_html() - # var zzipitime = 15 + #: var zzipitime = 15 m = re.search(r'var zzipitime = (\d+);', self.html) if m: sec = int(m.group(1)) diff --git a/module/plugins/hoster/SimplydebridCom.py b/module/plugins/hoster/SimplydebridCom.py index d054a3c54..9301f1e93 100644 --- a/module/plugins/hoster/SimplydebridCom.py +++ b/module/plugins/hoster/SimplydebridCom.py @@ -20,7 +20,7 @@ class SimplydebridCom(MultiHoster): def handle_premium(self, pyfile): - # fix the links for simply-debrid.com! + #: Fix the links for simply-debrid.com! self.link = replace_patterns(pyfile.url, [("clz.to", "cloudzer.net/file") ("http://share-online", "http://www.share-online") ("ul.to", "uploaded.net/file") diff --git a/module/plugins/hoster/SmoozedCom.py b/module/plugins/hoster/SmoozedCom.py index c278881f8..63d15153c 100644 --- a/module/plugins/hoster/SmoozedCom.py +++ b/module/plugins/hoster/SmoozedCom.py @@ -24,7 +24,7 @@ class SmoozedCom(MultiHoster): def handle_free(self, pyfile): #: In some cases hostsers do not supply us with a filename at download, so we - #: are going to set a fall back filename (e.g. for freakshare or xfileshare) + #: Are going to set a fall back filename (e.g. for freakshare or xfileshare) pyfile.name = pyfile.name.split('/').pop() #: Remove everthing before last slash #: Correction for automatic assigned filename: Removing html at end if needed diff --git a/module/plugins/hoster/SoundcloudCom.py b/module/plugins/hoster/SoundcloudCom.py index 97d5223be..5e71c36e8 100644 --- a/module/plugins/hoster/SoundcloudCom.py +++ b/module/plugins/hoster/SoundcloudCom.py @@ -37,7 +37,7 @@ class SoundcloudCom(SimpleHoster): except Exception: client_id = "b45b1aa10f1ac2941910a7f0d10f8e28" - #: url to retrieve the actual song url + #: Url to retrieve the actual song url streams = json_loads(self.load("https://api.soundcloud.com/tracks/%s/streams" % song_id, get={'client_id': client_id})) diff --git a/module/plugins/hoster/TurbobitNet.py b/module/plugins/hoster/TurbobitNet.py index 46b15169b..28f2a240e 100644 --- a/module/plugins/hoster/TurbobitNet.py +++ b/module/plugins/hoster/TurbobitNet.py @@ -102,7 +102,7 @@ class TurbobitNet(SimpleHoster): #: that's right, we are even using jdownloader updates rtUpdate = self.load("http://update0.jdownloader.org/pluginstuff/tbupdate.js") rtUpdate = self.decrypt(rtUpdate.splitlines()[1]) - #: but we still need to fix the syntax to work with other engines than rhino + #: But we still need to fix the syntax to work with other engines than rhino rtUpdate = re.sub(r'for each\(var (\w+) in(\[[^\]]+\])\)\{', r'zza=\2;for(var zzi=0;zzi<zza.length;zzi++){\1=zza[zzi];', rtUpdate) rtUpdate = re.sub(r"for\((\w+)=", r"for(var \1=", rtUpdate) @@ -144,7 +144,7 @@ class TurbobitNet(SimpleHoster): self.log_error(e) else: if self.retries >= 2: - #: retry with updated js + #: Retry with updated js self.delete("rtUpdate") else: self.retry() diff --git a/module/plugins/hoster/UlozTo.py b/module/plugins/hoster/UlozTo.py index 85f20d406..3841a78fe 100644 --- a/module/plugins/hoster/UlozTo.py +++ b/module/plugins/hoster/UlozTo.py @@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo def convert_decimal_prefix(m): - #: decimal prefixes used in filesize and traffic + #: Decimal prefixes used in filesize and traffic return ("%%.%df" % {'k': 3, 'M': 6, 'G': 9}[m.group(2)] % float(m.group(1))).replace('.', '') @@ -54,7 +54,7 @@ class UlozTo(SimpleHoster): self.error(_("Free download form not found")) self.log_debug("inputs.keys = " + str(inputs.keys())) - #: get and decrypt captcha + #: Get and decrypt captcha if all(key in inputs for key in ("captcha_value", "captcha_id", "captcha_key")): #: Old version - last seen 9.12.2013 self.log_debug('Using "old" version') @@ -124,7 +124,7 @@ class UlozTo(SimpleHoster): "wrong_captcha": re.compile(r'<ul class="error">\s*<li>Error rewriting the text.</li>'), "offline" : re.compile(self.OFFLINE_PATTERN), "passwd" : self.PASSWD_PATTERN, - "server_error" : 'src="http://img.ulozto.cz/error403/vykricnik.jpg"', #: paralell dl, server overload etc. + "server_error" : 'src="http://img.ulozto.cz/error403/vykricnik.jpg"', #: Paralell dl, server overload etc. "not_found" : "<title>Ulož.to</title>" }) diff --git a/module/plugins/hoster/UploadedTo.py b/module/plugins/hoster/UploadedTo.py index e8c317296..d04664a8f 100644 --- a/module/plugins/hoster/UploadedTo.py +++ b/module/plugins/hoster/UploadedTo.py @@ -62,7 +62,7 @@ class UploadedTo(SimpleHoster): def setup(self): self.multi_dl = self.resume_download = self.premium - self.chunk_limit = 1 #: critical problems with more chunks + self.chunk_limit = 1 #: Critical problems with more chunks def handle_free(self, pyfile): diff --git a/module/plugins/hoster/UpstoreNet.py b/module/plugins/hoster/UpstoreNet.py index f628e1db3..7c014d53f 100644 --- a/module/plugins/hoster/UpstoreNet.py +++ b/module/plugins/hoster/UpstoreNet.py @@ -28,21 +28,21 @@ class UpstoreNet(SimpleHoster): def handle_free(self, pyfile): - # STAGE 1: get link to continue + #: STAGE 1: get link to continue m = re.search(self.CHASH_PATTERN, self.html) if m is None: self.error(_("CHASH_PATTERN not found")) chash = m.group(1) self.log_debug("Read hash " + chash) - #: continue to stage2 + #: Continue to stage2 post_data = {'hash': chash, 'free': 'Slow download'} self.html = self.load(pyfile.url, post=post_data) - # STAGE 2: solv captcha and wait - # first get the infos we need: recaptcha key and wait time + #: STAGE 2: solv captcha and wait + #: First get the infos we need: recaptcha key and wait time recaptcha = ReCaptcha(self) - #: try the captcha 5 times + #: Try the captcha 5 times for i in xrange(5): m = re.search(self.WAIT_PATTERN, self.html) if m is None: @@ -59,7 +59,7 @@ class UpstoreNet(SimpleHoster): self.html = self.load(pyfile.url, post=post_data) - # STAGE 3: get direct link + #: STAGE 3: get direct link m = re.search(self.LINK_FREE_PATTERN, self.html, re.S) if m: break diff --git a/module/plugins/hoster/VeehdCom.py b/module/plugins/hoster/VeehdCom.py index abf4f1c7a..9993a6c6a 100644 --- a/module/plugins/hoster/VeehdCom.py +++ b/module/plugins/hoster/VeehdCom.py @@ -58,7 +58,7 @@ class VeehdCom(Hoster): name = m.group(1) - #: replace unwanted characters in filename + #: Replace unwanted characters in filename if self.get_config('filename_spaces'): pattern = '[^\w ]+' else: diff --git a/module/plugins/hoster/Xdcc.py b/module/plugins/hoster/Xdcc.py index 0e200307e..1e3bcc215 100644 --- a/module/plugins/hoster/Xdcc.py +++ b/module/plugins/hoster/Xdcc.py @@ -33,7 +33,7 @@ class Xdcc(Hoster): def process(self, pyfile): - #: change request type + #: Change request type self.req = self.core.requestFactory.getRequest(self.__name__, type="XDCC") self.pyfile = pyfile @@ -59,7 +59,7 @@ class Xdcc(Hoster): def do_download(self, url): - self.pyfile.setStatus("waiting") #: real link + self.pyfile.setStatus("waiting") #: Real link m = re.match(r'xdcc://(.*?)/#?(.*?)/(.*?)/#?(\d+)/?', url) server = m.group(1) @@ -102,7 +102,7 @@ class Xdcc(Hoster): m = None while True: - #: done is set if we got our real link + #: Done is set if we got our real link if done: break @@ -177,7 +177,7 @@ class Xdcc(Hoster): if m: done = True - #: get connection data + #: Get connection data ip = socket.inet_ntoa(struct.pack('L', socket.ntohl(int(m.group(2))))) port = int(m.group(3)) packname = m.group(1) diff --git a/module/plugins/hoster/YourfilesTo.py b/module/plugins/hoster/YourfilesTo.py index 0b631fb23..0124f7b8c 100644 --- a/module/plugins/hoster/YourfilesTo.py +++ b/module/plugins/hoster/YourfilesTo.py @@ -38,7 +38,7 @@ class YourfilesTo(Hoster): if not self.html: self.download_html() - # var zzipitime = 15 + #: var zzipitime = 15 m = re.search(r'var zzipitime = (\d+);', self.html) if m: sec = int(m.group(1)) diff --git a/module/plugins/hoster/YoutubeCom.py b/module/plugins/hoster/YoutubeCom.py index 248fc3715..330fe8063 100644 --- a/module/plugins/hoster/YoutubeCom.py +++ b/module/plugins/hoster/YoutubeCom.py @@ -94,7 +94,7 @@ class YoutubeCom(Hoster): if "We have been receiving a large volume of requests from your network." in html: self.temp_offline() - # get config + #: Get config use3d = self.get_config('3d') if use3d: @@ -113,17 +113,17 @@ class YoutubeCom(Hoster): self.log_warning(_("FMT %d unknown, using default") % desired_fmt) desired_fmt = 0 - # parse available streams + #: Parse available streams streams = re.search(r'"url_encoded_fmt_stream_map":"(.+?)",', html).group(1) streams = [x.split('\u0026') for x in streams.split(',')] streams = [dict((y.split('=', 1)) for y in x) for x in streams] streams = [(int(x['itag']), urllib.unquote(x['url'])) for x in streams] - #: self.log_debug("Found links: %s" % streams) + # self.log_debug("Found links: %s" % streams) self.log_debug("AVAILABLE STREAMS: %s" % [x[0] for x in streams]) - # build dictionary of supported itags (3D/2D) + #: Build dictionary of supported itags (3D/2D) allowed = lambda x: self.get_config(self.formats[x][0]) streams = [x for x in streams if x[0] in self.formats and allowed(x[0])] @@ -136,11 +136,11 @@ class YoutubeCom(Hoster): (desired_fmt, "%s %dx%d Q:%d 3D:%s" % self.formats[desired_fmt], "" if desired_fmt in fmt_dict else "NOT ", "" if allowed(desired_fmt) else "NOT ")) - # return fmt nearest to quality index + #: Return fmt nearest to quality index if desired_fmt in fmt_dict and allowed(desired_fmt): fmt = desired_fmt else: - sel = lambda x: self.formats[x][3] #: select quality index + sel = lambda x: self.formats[x][3] #: Select quality index comp = lambda x, y: abs(sel(x) - sel(y)) self.log_debug("Choosing nearest fmt: %s" % [(x, allowed(x), comp(x, desired_fmt)) for x in fmt_dict.keys()]) @@ -154,7 +154,7 @@ class YoutubeCom(Hoster): self.log_debug("URL: %s" % url) - # set file name + #: Set file name file_suffix = self.formats[fmt][0] if fmt in self.formats else ".flv" file_name_pattern = '<meta name="title" content="(.+?)">' name = re.search(file_name_pattern, html).group(1).replace("/", "") diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py index 48c17ea5f..1881f66bb 100644 --- a/module/plugins/hoster/ZippyshareCom.py +++ b/module/plugins/hoster/ZippyshareCom.py @@ -58,35 +58,35 @@ class ZippyshareCom(SimpleHoster): def get_link(self): - #: get all the scripts inside the html body + #: Get all the scripts inside the html body soup = BeautifulSoup.BeautifulSoup(self.html) scripts = (s.getText().strip() for s in soup.body.findAll('script', type='text/javascript')) - #: meant to be populated with the initialization of all the DOM elements found in the scripts + #: Meant to be populated with the initialization of all the DOM elements found in the scripts initScripts = set() def repl_element_by_id(element): - id = element.group(1) #: id might be either 'x' (a real id) or x (a variable) - attr = element.group(4) #: attr might be None + id = element.group(1) #: Id might be either 'x' (a real id) or x (a variable) + attr = element.group(4) #: Attr might be None varName = re.sub(r'-', '', 'GVAR[%s+"_%s"]' %(id, attr)) realid = id.strip('"\'') - if id != realid: #: id is not a variable, so look for realid.attr in the html + if id != realid: #: Id is not a variable, so look for realid.attr in the html initValues = filter(None, [elt.get(attr, None) for elt in soup.findAll(id=realid)]) initValue = '"%s"' % initValues[-1] if initValues else 'null' initScripts.add('%s = %s;' % (varName, initValue)) return varName - #: handle all getElementById + #: Handle all getElementById reVar = r'document.getElementById\(([\'"\w-]+)\)(\.)?(getAttribute\([\'"])?(\w+)?([\'"]\))?' scripts = [re.sub(reVar, repl_element_by_id, script) for script in scripts if script] - #: add try/catch in JS to handle deliberate errors + #: Add try/catch in JS to handle deliberate errors scripts = ['\n'.join(('try{', script, '} catch(err){}')) for script in scripts] - #: get the file's url by evaluating all the scripts + #: Get the file's url by evaluating all the scripts scripts = ['var GVAR = {}'] + list(initScripts) + scripts + ['GVAR['dlbutton_href']'] return self.js.eval('\n'.join(scripts)) |