diff options
Diffstat (limited to 'module')
87 files changed, 360 insertions, 356 deletions
diff --git a/module/plugins/accounts/AlldebridCom.py b/module/plugins/accounts/AlldebridCom.py index cfa7840bc..9c27c18d0 100644 --- a/module/plugins/accounts/AlldebridCom.py +++ b/module/plugins/accounts/AlldebridCom.py @@ -24,7 +24,7 @@ class AlldebridCom(Account): html = self.load("http://www.alldebrid.com/account/") soup = BeautifulSoup.BeautifulSoup(html) - # Try to parse expiration date directly from the control panel page (better accuracy) + #: Try to parse expiration date directly from the control panel page (better accuracy) try: time_text = soup.find('div', attrs={'class': 'remaining_time_text'}).strong.string @@ -35,7 +35,7 @@ class AlldebridCom(Account): exp_time = time.time() + int(exp_data[0]) * 24 * 60 * 60 + int( exp_data[1]) * 60 * 60 + (int(exp_data[2]) - 1) * 60 - # Get expiration date from API + #: Get expiration date from API except Exception: data = self.get_account_data(user) html = self.load("https://www.alldebrid.com/api.php", diff --git a/module/plugins/accounts/FileserveCom.py b/module/plugins/accounts/FileserveCom.py index 90ddc5fd2..edbf4a1cf 100644 --- a/module/plugins/accounts/FileserveCom.py +++ b/module/plugins/accounts/FileserveCom.py @@ -42,7 +42,7 @@ class FileserveCom(Account): if not res['type']: self.wrong_password() - # login at fileserv html + #: Login at fileserv html self.load("http://www.fileserve.com/login.php", post={"loginUserName": user, "loginUserPassword": data['password'], diff --git a/module/plugins/accounts/HellshareCz.py b/module/plugins/accounts/HellshareCz.py index bd6f72972..9556f2bda 100644 --- a/module/plugins/accounts/HellshareCz.py +++ b/module/plugins/accounts/HellshareCz.py @@ -33,14 +33,14 @@ class HellshareCz(Account): premium = True try: if "." in credit: - # Time-based account + #: Time-based account vt = [int(x) for x in credit.split('.')[:2]] lt = time.localtime() year = lt.tm_year + int(vt[1] < lt.tm_mon or (vt[1] == lt.tm_mon and vt[0] < lt.tm_mday)) validuntil = time.mktime(time.strptime("%s%d 23:59:59" % (credit, year), "%d.%m.%Y %H:%M:%S")) trafficleft = -1 else: - # Traffic-based account + #: Traffic-based account trafficleft = self.parse_traffic(credit + "MB") validuntil = -1 except Exception, e: @@ -54,7 +54,7 @@ class HellshareCz(Account): def login(self, user, data, req): html = self.load('http://www.hellshare.com/') if req.lastEffectiveURL != 'http://www.hellshare.com/': - # Switch to English + #: Switch to English self.log_debug("Switch lang - URL: %s" % req.lastEffectiveURL) json = self.load("%s?do=locRouter-show" % req.lastEffectiveURL) diff --git a/module/plugins/accounts/LetitbitNet.py b/module/plugins/accounts/LetitbitNet.py index 4702648a3..45295d379 100644 --- a/module/plugins/accounts/LetitbitNet.py +++ b/module/plugins/accounts/LetitbitNet.py @@ -16,10 +16,10 @@ class LetitbitNet(Account): def load_account_info(self, user, req): ## DISABLED BECAUSE IT GET 'key exausted' EVEN IF VALID ## - # api_key = self.get_account_data(user)['password'] + # api_key = self.get_account_data(user)['password'] # json_data = [api_key, ['key/info']] - # api_rep = self.load("http://api.letitbit.net/json", - # post={'r': json_dumps(json_data)}) + # api_rep = self.load("http://api.letitbit.net/json", + # post={'r': json_dumps(json_data)}) # self.log_debug("API Key Info: " + api_rep) # api_rep = json_loads(api_rep) # diff --git a/module/plugins/accounts/MegaRapidoNet.py b/module/plugins/accounts/MegaRapidoNet.py index 92e5242bb..c07f97842 100644 --- a/module/plugins/accounts/MegaRapidoNet.py +++ b/module/plugins/accounts/MegaRapidoNet.py @@ -29,7 +29,7 @@ class MegaRapidoNet(Account): validuntil = re.search(self.VALID_UNTIL_PATTERN, html) if validuntil: - # hier weitermachen!!! (müssen umbedingt die zeit richtig machen damit! (sollte aber möglich)) + #: Hier weitermachen!!! (müssen umbedingt die zeit richtig machen damit! (sollte aber möglich)) validuntil = time.time() + int(validuntil.group(1)) * 24 * 3600 + int(validuntil.group(2)) * 3600 + int(validuntil.group(3)) * 60 + int(validuntil.group(4)) trafficleft = -1 premium = True diff --git a/module/plugins/accounts/PremiumizeMe.py b/module/plugins/accounts/PremiumizeMe.py index a2a6c139c..869000f04 100644 --- a/module/plugins/accounts/PremiumizeMe.py +++ b/module/plugins/accounts/PremiumizeMe.py @@ -40,7 +40,7 @@ class PremiumizeMe(Account): def get_account_status(self, user, req): #: Use premiumize.me API v1 (see https://secure.premiumize.me/?show=api) - #: to retrieve account info and return the parsed json answer + #: To retrieve account info and return the parsed json answer answer = self.load("http://api.premiumize.me/pm-api/v1.php", #@TODO: Revert to `https` in 0.4.10 get={'method' : "accountstatus", 'params[login]': user, diff --git a/module/plugins/accounts/RPNetBiz.py b/module/plugins/accounts/RPNetBiz.py index d103e918d..db5dbbb24 100644 --- a/module/plugins/accounts/RPNetBiz.py +++ b/module/plugins/accounts/RPNetBiz.py @@ -26,7 +26,7 @@ class RPNetBiz(Account): account_info = {"validuntil": None, "trafficleft": None, "premium": False} except KeyError: - # handle wrong password exception + #: Handle wrong password exception account_info = {"validuntil": None, "trafficleft": None, "premium": False} return account_info diff --git a/module/plugins/captcha/CircleCaptcha.py b/module/plugins/captcha/CircleCaptcha.py index 54bd5a975..a76cbc679 100644 --- a/module/plugins/captcha/CircleCaptcha.py +++ b/module/plugins/captcha/CircleCaptcha.py @@ -59,25 +59,25 @@ class CircleCaptcha(OCR): if curpix > self.BACKGROUND: if howmany <= cleandeep and howmany > 0: - #: clean pixel + #: Clean pixel for ic in xrange(1, cleandeep+1): if x -ic > 0: pix[x-ic, y] = self.BACKGROUND jump = False howmany = 0 curcolor = curpix - #: print (x, y), jump, 2 + # print (x, y), jump, 2 else: if howmany == 0: - #: found pixel + #: Found pixel jump = True howmany = howmany + 1 curcolor = curpix - #: print (x, y), jump, 2 + # print (x, y), jump, 2 else: howmany = howmany + 1 if howmany == 1: - #: clean pixel + #: Clean pixel pix[x-1, y] = self.BACKGROUND curcolor = self.BACKGROUND @@ -86,10 +86,10 @@ class CircleCaptcha(OCR): howmany = 0 for y in imageheight: curpix = pix[x, y] - #: if jump == True: + # if jump == True: if curpix > self.BACKGROUND: if howmany <= cleandeep and howmany > 0: - #: clean pixel + #: Clean pixel for ic in xrange(1, cleandeep+1): #: raw_input('2'+str(ic)) if y-ic > 0: @@ -97,18 +97,18 @@ class CircleCaptcha(OCR): jump = False howmany = 0 curcolor = curpix - #: print (x, y), jump + # print (x, y), jump else: if howmany == 0: - #: found pixel + #: Found pixel jump = True howmany = howmany + 1 curcolor = curpix - #: print (x, y), jump + # print (x, y), jump else: howmany = howmany + 1 if howmany == 1: - #: clean pixel + #: Clean pixel pix[x-1, y] = self.BACKGROUND #: return -1 @@ -126,18 +126,18 @@ class CircleCaptcha(OCR): if curpix < self.BLACKCOLOR: blackfound = blackfound + 1 if ExitWithBlack == True and blackfound >= 3: - break #: exit if found black + break #: Exit if found black else: continue if curpix >= self.BACKGROUND: - #: found first pixel white + #: Found first pixel white jump = False continue if (curpix < self.BACKGROUND and color == -1) or (curpix == color and color > -1): if jump == False: - #: found pixel + #: Found pixel curcolor = curpix newx = x, curcolor break @@ -156,17 +156,17 @@ class CircleCaptcha(OCR): if curpix < self.BLACKCOLOR: blackfound = blackfound + 1 if ExitWithBlack == True and blackfound >= 3: - break #: exit if found black + break #: Exit if found black else: continue if curpix >= self.BACKGROUND: if newx != (-1,-1): - #: found last pixel and the first white + #: Found last pixel and the first white break if (curpix < self.BACKGROUND and color == -1) or (curpix == color and color > -1): - #: found pixel + #: Found pixel curcolor = curpix newx = x, curcolor @@ -187,17 +187,17 @@ class CircleCaptcha(OCR): if curpix < self.BLACKCOLOR: blackfound = blackfound + 1 if ExitWithBlack == True and blackfound >= 3: - break #: exit if found black + break #: Exit if found black else: continue if curpix >= self.BACKGROUND: if newy != (-1,-1): - #: found last pixel and the first white + #: Found last pixel and the first white break if (curpix < self.BACKGROUND and color == -1) or (curpix == color and color > -1): - #: found pixel + #: Found pixel curcolor = curpix newy = y, color @@ -205,7 +205,7 @@ class CircleCaptcha(OCR): def find_circle(self, pix, x1, y1, x2, y2, x3, y3): - #: trasposizione coordinate + #: Trasposizione coordinate #: A(0, 0) B(x2-x1, y2-y1) C(x3-x1, y3-y1) #: x**2+y**2+ax+bx+c=0 p1 = (0, 0) @@ -258,7 +258,7 @@ class CircleCaptcha(OCR): if (c[2] < min_ray) or (c[2] > max_ray): return -1 - #: check cardinal points (at least 3) (if found i have to leave this position) + #: Check cardinal points (at least 3) (if found i have to leave this position) if pix[c[0] + c[2],c[1]] < self.BLACKCOLOR: return -2 if pix[c[0] - c[2],c[1]] < self.BLACKCOLOR: @@ -339,7 +339,7 @@ class CircleCaptcha(OCR): if (c[2] < min_ray) or (c[2] > max_ray): return -1 - #: check cardinal points (at least 3) (if found i have to leave this position) + #: Check cardinal points (at least 3) (if found i have to leave this position) if pix[c[0] + c[2],c[1]] < self.BLACKCOLOR: return -2 if pix[c[0] - c[2],c[1]] < self.BLACKCOLOR: @@ -418,18 +418,18 @@ class CircleCaptcha(OCR): return -2 for p in missinglist: - #: left and bottom + #: Left and bottom if (self.verify_point(im, pix, p[0]-1, p[1],exactfind) == 1 and \ self.verify_point(im, pix, p[0], p[1]+1, exactfind) == 1): missing = missing - 1 elif (self.verify_point(im, pix, p[0]-1, p[1],exactfind) == 1 and \ self.verify_point(im, pix, p[0], p[1]-1, exactfind) == 1): missing = missing - 1 - #: right and bottom + #: Right and bottom elif (self.verify_point(im, pix, p[0]+1, p[1],exactfind) == 1 and \ self.verify_point(im, pix, p[0], p[1]+1, exactfind) == 1): missing = missing - 1 - #: right and up + #: Right and up elif (self.verify_point(im, pix, p[0]+1, p[1],exactfind) == 1 and \ self.verify_point(im, pix, p[0], p[1]-1, exactfind) == 1): missing = missing - 1 @@ -487,7 +487,7 @@ class CircleCaptcha(OCR): missingconsecutive >= (howmany / 4) * 2 or \ howmany < 80: return -1 - #: elif missing / howmany < 0.10: + # elif missing / howmany < 0.10: elif missing == 0: self.pointsofcirclefound.extend(pointsofcircle) return 1 @@ -531,7 +531,7 @@ class CircleCaptcha(OCR): result = 1 if curpix <= self.BLACKCOLOR: result = -1 - #: print str((x, y)) + " = " + str(result) + # print str((x, y)) + " = " + str(result) return result @@ -547,7 +547,7 @@ class CircleCaptcha(OCR): if self._DEBUG == True: iDebugSaveFile = iDebugSaveFile + 1 - #: if iDebugSaveFile < 7: continue + # if iDebugSaveFile < 7: continue im.save("output" + str(iDebugSaveFile) + ".png", "png") raw_input('frame: '+ str(im)) @@ -575,7 +575,7 @@ class CircleCaptcha(OCR): found = set() findnewcircle = True - #: finding all the circles + #: Finding all the circles for y1 in stepheight: x1 = 1 curcolor = -1 @@ -588,10 +588,12 @@ class CircleCaptcha(OCR): break if x1 == -1: break - if self._DEBUG == True: print "x1, y1 -> " + str((x1, y1)) + ": " + str(pix[x1, y1]) + if self._DEBUG == True: + print "x1, y1 -> " + str((x1, y1)) + ": " + str(pix[x1, y1]) if (x1, y1) in self.pointsofcirclefound: - if self._DEBUG == True: print 'found ' + str((x1, y1)) + if self._DEBUG == True: + print 'found ' + str((x1, y1)) continue if self._DEBUG == True: pixcopy[x1, y1] = 45 #(255, 0, 0, 255) @@ -606,7 +608,8 @@ class CircleCaptcha(OCR): break if x2 == -1: break - if self._DEBUG == True: print "x2, y2 -> " + str((x2, y1)) + ": " + str(pix[x2, y1]) + if self._DEBUG == True: + print "x2, y2 -> " + str((x2, y1)) + ": " + str(pix[x2, y1]) if abs(x2 - x1) < min_distance: continue if abs(x2 - x1) > (im.size[1] * 2 / 3): @@ -616,14 +619,14 @@ class CircleCaptcha(OCR): if self._DEBUG == True: pixcopy[x2, y2] = 65 #(0, 255, 0, 255) #: found 2 pixel, seeking x3, y3 - #: verify cord + #: Verify cord for invert in xrange(0, 2): x3 = math.floor(x2 - ((x2 - x1) / 2)) y3 = y1 for j in xrange(1, 50): retval = self.find_last_pixel_y(im, pix, x3, y3, True if invert == 1 else False, -1, True) - #: print (x3, y3, retval[0],invert) + # print (x3, y3, retval[0],invert) y3 = retval[0] if y3 == -2: findnewcircle = True @@ -631,8 +634,9 @@ class CircleCaptcha(OCR): if y3 == -1: break - if self._DEBUG == True: print "x3, y3 -> " + str((x3, y3)) + ": " + str(pix[x3, y3]) - #: verify cord + if self._DEBUG == True: + print "x3, y3 -> " + str((x3, y3)) + ": " + str(pix[x3, y3]) + #: Verify cord if abs(y3 - y2) < min_distance: continue if abs(y3 - y2) > (im.size[1] * 2 / 3): @@ -662,10 +666,10 @@ class CircleCaptcha(OCR): if self._DEBUG == True: _pause = "" - #: if verified == -1: - #: draw.ellipse((c[0]-c[2],c[1]-c[2],c[0]+c[2],c[1]+c[2]),outline=0) - #: _pause = "NOTDOUND" - #: imdebug.save("debug.png", "png") + # if verified == -1: + # draw.ellipse((c[0]-c[2],c[1]-c[2],c[0]+c[2],c[1]+c[2]),outline=0) + # _pause = "NOTDOUND" + # imdebug.save("debug.png", "png") if verified == 0: draw.ellipse((c[0]-c[2],c[1]-c[2],c[0]+c[2],c[1]+c[2]),outline=120) _pause = "OPENED" @@ -691,7 +695,7 @@ class CircleCaptcha(OCR): if self._DEBUG == True: print 'Howmany opened circle? ' + str(len(found)) + ' ' + str(found) - #: clean results + #: Clean results for c in found: verify = c[1] if verify == 0: @@ -707,7 +711,7 @@ class CircleCaptcha(OCR): ((p[0]-1, p[1]-1, p[2]),1) in found \ ): - #: delete nearly circle + #: Delete nearly circle verify = -1 if ( ((p[0], p[1]+1, p[2]+1),1) in found or \ @@ -720,7 +724,7 @@ class CircleCaptcha(OCR): ((p[0]-1, p[1]-1, p[2]+1),1) in found \ ): - #: delete nearly circle + #: Delete nearly circle verify = -1 if ( ((p[0], p[1]+1, p[2]-1),1) in found or \ @@ -733,22 +737,22 @@ class CircleCaptcha(OCR): ((p[0]-1, p[1]-1, p[2]-1),1) in found \ ): - #: delete nearly circle + #: Delete nearly circle verify = -1 - #: if verify == 0: - #: if self._DEBUG == True: - #: pix[c[0][0],c[0][1]] = 90 #(255, 255, 0) - #: im.save("output.png", "png") - #: return c[0][0],c[0][1] - #: elif verify == 1: - #: if self._DEBUG == True: - #: pix[c[0][0],c[0][1]] = 40 #(255, 0, 0) - #: im.save("output.png", "png") - #: else: - #: if self._DEBUG == True: - #: pix[c[0][0],c[0][1]] = 180 #(0, 0, 255) - #: im.save("output.png", "png") + # if verify == 0: + # if self._DEBUG == True: + # pix[c[0][0],c[0][1]] = 90 #(255, 255, 0) + # im.save("output.png", "png") + # return c[0][0],c[0][1] + # elif verify == 1: + # if self._DEBUG == True: + # pix[c[0][0],c[0][1]] = 40 #(255, 0, 0) + # im.save("output.png", "png") + # else: + # if self._DEBUG == True: + # pix[c[0][0],c[0][1]] = 180 #(0, 0, 255) + # im.save("output.png", "png") if self._DEBUG == True: im.save("output.png", "png") diff --git a/module/plugins/captcha/ShareonlineBiz.py b/module/plugins/captcha/ShareonlineBiz.py index a8c1a3abe..234f39a51 100644 --- a/module/plugins/captcha/ShareonlineBiz.py +++ b/module/plugins/captcha/ShareonlineBiz.py @@ -36,4 +36,4 @@ class ShareonlineBiz(OCR): return final - # tesseract at 60% + #: Tesseract at 60% diff --git a/module/plugins/container/TXT.py b/module/plugins/container/TXT.py index b7355d80c..52f597f9f 100644 --- a/module/plugins/container/TXT.py +++ b/module/plugins/container/TXT.py @@ -43,7 +43,7 @@ class TXT(Container): continue if link.startswith("[") and link.endswith("]"): - #: new package + #: New package curPack = link[1:-1] packages[curPack] = [] continue @@ -52,7 +52,7 @@ class TXT(Container): txt.close() - #: empty packages fix + #: Empty packages fix for key, value in packages.iteritems(): if not value: packages.pop(key, None) diff --git a/module/plugins/crypter/DailymotionComFolder.py b/module/plugins/crypter/DailymotionComFolder.py index 84d2c773c..d3d68b7c7 100644 --- a/module/plugins/crypter/DailymotionComFolder.py +++ b/module/plugins/crypter/DailymotionComFolder.py @@ -102,4 +102,4 @@ class DailymotionComFolder(Crypter): p_videos = self.get_videos(p_id) p_folder = fs_join(self.core.config.get("general", "download_folder"), p_owner, p_name) self.log_debug("%s video\s found on playlist \"%s\"" % (len(p_videos), p_name)) - self.packages.append((p_name, p_videos, p_folder)) #: folder is NOT recognized by pyload 0.4.9! + self.packages.append((p_name, p_videos, p_folder)) #: Folder is NOT recognized by pyload 0.4.9! diff --git a/module/plugins/crypter/FilecryptCc.py b/module/plugins/crypter/FilecryptCc.py index 341b1e13f..624dadb94 100644 --- a/module/plugins/crypter/FilecryptCc.py +++ b/module/plugins/crypter/FilecryptCc.py @@ -88,7 +88,7 @@ class FilecryptCc(Crypter): m = re.search(self.CAPTCHA_PATTERN, self.html) m2 = re.search(self.CIRCLE_CAPTCHA_PATTERN, self.html) - if m: #: normal captcha + if m: #: Normal captcha self.log_debug("Captcha-URL: %s" % m.group(1)) captcha_code = self.decrypt_captcha(urlparse.urljoin(self.base_url, m.group(1)), @@ -97,7 +97,7 @@ class FilecryptCc(Crypter): self.site_with_links = self.load(self.pyfile.url, post={'recaptcha_response_field': captcha_code}) - elif m2: #: circle captcha + elif m2: #: Circle captcha self.log_debug("Captcha-URL: %s" % m2.group(1)) captcha_code = self.decrypt_captcha('%s%s?c=abc' %(self.base_url, m2.group(1)), diff --git a/module/plugins/crypter/LinkCryptWs.py b/module/plugins/crypter/LinkCryptWs.py index a5d4d7e59..4fe2384da 100644 --- a/module/plugins/crypter/LinkCryptWs.py +++ b/module/plugins/crypter/LinkCryptWs.py @@ -42,7 +42,7 @@ class LinkCryptWs(Crypter): self.req.cj.setCookie("linkcrypt.ws", "language", "en") #: Request package - self.req.http.c.setopt(pycurl.USERAGENT, "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko") #: better chance to not get those key-captchas + self.req.http.c.setopt(pycurl.USERAGENT, "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko") #: Better chance to not get those key-captchas self.html = self.load(self.pyfile.url) @@ -68,13 +68,13 @@ class LinkCryptWs(Crypter): self.unlock_password_protection() self.handle_errors() - #: get unrar password + #: Get unrar password self.getunrarpw() #: Get package name and folder package_name, folder_name = self.get_package_info() - # get the container definitions from script section + #: Get the container definitions from script section self.get_container_html() #: Extract package links @@ -234,7 +234,7 @@ class LinkCryptWs(Crypter): self.log_debug('Search for %s Container links' % type.upper()) - if not type.isalnum(): #: check to prevent broken re-pattern (cnl2, rsdf, ccf, dlc, web are all alpha-numeric) + if not type.isalnum(): #: Check to prevent broken re-pattern (cnl2, rsdf, ccf, dlc, web are all alpha-numeric) self.fail(_("Unknown container type: %s") % type) #@TODO: Replace with self.error in 0.4.10 for line in self.container_html: diff --git a/module/plugins/crypter/MediafireComFolder.py b/module/plugins/crypter/MediafireComFolder.py index 9ec8f9efe..02b5369ec 100644 --- a/module/plugins/crypter/MediafireComFolder.py +++ b/module/plugins/crypter/MediafireComFolder.py @@ -29,14 +29,14 @@ class MediafireComFolder(Crypter): self.log_debug("Location (%d): %s" % (result, url)) if result == 0: - #: load and parse html + #: Load and parse html html = self.load(pyfile.url) m = re.search(self.LINK_PATTERN, html) if m: - #: file page + #: File page self.urls.append("http://www.mediafire.com/file/%s" % m.group(1)) else: - #: folder page + #: Folder page m = re.search(self.FOLDER_KEY_PATTERN, html) if m: folder_key = m.group(1) diff --git a/module/plugins/crypter/NCryptIn.py b/module/plugins/crypter/NCryptIn.py index 8abf06602..195bde539 100644 --- a/module/plugins/crypter/NCryptIn.py +++ b/module/plugins/crypter/NCryptIn.py @@ -69,7 +69,7 @@ class NCryptIn(Crypter): #: Extract package links for link_source_type in self.links_source_order: package_links.extend(self.handle_link_source(link_source_type)) - if package_links: #: use only first source which provides links + if package_links: #: Use only first source which provides links break package_links = set(package_links) diff --git a/module/plugins/crypter/RelinkUs.py b/module/plugins/crypter/RelinkUs.py index b270ccbbd..77d5eff50 100644 --- a/module/plugins/crypter/RelinkUs.py +++ b/module/plugins/crypter/RelinkUs.py @@ -89,7 +89,7 @@ class RelinkUs(Crypter): package_links = [] for sources in self.PREFERRED_LINK_SOURCES: package_links.extend(self.handle_link_source(sources)) - if package_links: #: use only first source which provides links + if package_links: #: Use only first source which provides links break package_links = set(package_links) diff --git a/module/plugins/crypter/ShSt.py b/module/plugins/crypter/ShSt.py index a65522aea..05a5518d3 100644 --- a/module/plugins/crypter/ShSt.py +++ b/module/plugins/crypter/ShSt.py @@ -22,9 +22,9 @@ class ShSt(Crypter): def decrypt(self, pyfile): - # if we use curl as a user agent, we will get a straight redirect (no waiting!) + #: If we use curl as a user agent, we will get a straight redirect (no waiting!) self.req.http.c.setopt(pycurl.USERAGENT, "curl/7.42.1") - # fetch the target URL + #: Fetch the target URL header = self.load(self.pyfile.url, just_header = True, decode = False) target_url = header["location"] self.urls.append(target_url) diff --git a/module/plugins/crypter/YoutubeComFolder.py b/module/plugins/crypter/YoutubeComFolder.py index 4b11e1244..b68630f44 100644 --- a/module/plugins/crypter/YoutubeComFolder.py +++ b/module/plugins/crypter/YoutubeComFolder.py @@ -142,6 +142,6 @@ class YoutubeComFolder(Crypter): else: p_urls = map(urlize, p_videos) - self.packages.append((p_name, p_urls, p_folder)) #: folder is NOT recognized by pyload 0.4.9! + self.packages.append((p_name, p_urls, p_folder)) #: Folder is NOT recognized by pyload 0.4.9! addedvideos.extend(p_videos) diff --git a/module/plugins/hooks/BypassCaptcha.py b/module/plugins/hooks/BypassCaptcha.py index ab08c68c1..42c30ba25 100644 --- a/module/plugins/hooks/BypassCaptcha.py +++ b/module/plugins/hooks/BypassCaptcha.py @@ -63,7 +63,7 @@ class BypassCaptcha(Hook): def submit(self, captcha, captchaType="file", match=None): req = get_request() - # raise timeout threshold + #: Raise timeout threshold req.c.setopt(pycurl.LOW_SPEED_TIME, 80) try: diff --git a/module/plugins/hooks/Checksum.py b/module/plugins/hooks/Checksum.py index 7f42347df..4d2dbf576 100644 --- a/module/plugins/hooks/Checksum.py +++ b/module/plugins/hooks/Checksum.py @@ -110,7 +110,7 @@ class Checksum(Hook): if not os.path.isfile(local_file): self.check_failed(pyfile, None, "File does not exist") - #: validate file size + #: Validate file size if "size" in data: api_size = int(data['size']) file_size = os.path.getsize(local_file) @@ -121,7 +121,7 @@ class Checksum(Hook): data.pop('size', None) - #: validate checksum + #: Validate checksum if data and self.get_config('check_checksum'): if not 'md5' in data: diff --git a/module/plugins/hooks/ClickAndLoad.py b/module/plugins/hooks/ClickAndLoad.py index 109452105..c361d51b2 100644 --- a/module/plugins/hooks/ClickAndLoad.py +++ b/module/plugins/hooks/ClickAndLoad.py @@ -91,12 +91,12 @@ class ClickAndLoad(Hook): except NameError: self.log_error(_("pyLoad's webinterface is configured to use HTTPS, Please install python's ssl lib or disable HTTPS")) - client_socket.close() #: reset the connection. + client_socket.close() #: Reset the connection. continue except Exception, e: self.log_error(_("SSL error: %s") % e.message) - client_socket.close() #: reset the connection. + client_socket.close() #: Reset the connection. continue server_socket.connect(("127.0.0.1", webport)) diff --git a/module/plugins/hooks/DeleteFinished.py b/module/plugins/hooks/DeleteFinished.py index ec708eb10..5c613f5c6 100644 --- a/module/plugins/hooks/DeleteFinished.py +++ b/module/plugins/hooks/DeleteFinished.py @@ -50,8 +50,8 @@ class DeleteFinished(Hook): def activate(self): self.info['sleep'] = True - #: interval = self.get_config('interval') - #: self.plugin_config_changed(self.__name__, 'interval', interval) + # interval = self.get_config('interval') + # self.plugin_config_changed(self.__name__, 'interval', interval) self.interval = max(self.MIN_CHECK_INTERVAL, self.get_config('interval') * 60 * 60) self.add_event('package_finished', self.wakeup) diff --git a/module/plugins/hooks/DownloadScheduler.py b/module/plugins/hooks/DownloadScheduler.py index ed43683fa..e1114d615 100644 --- a/module/plugins/hooks/DownloadScheduler.py +++ b/module/plugins/hooks/DownloadScheduler.py @@ -25,7 +25,7 @@ class DownloadScheduler(Hook): def setup(self): self.info = {} #@TODO: Remove in 0.4.10 - self.cb = None #: callback to scheduler job; will be by removed hookmanager when hook unloaded + self.cb = None #: Callback to scheduler job; will be by removed hookmanager when hook unloaded def activate(self): diff --git a/module/plugins/hooks/ExpertDecoders.py b/module/plugins/hooks/ExpertDecoders.py index 919445db8..17890f691 100644 --- a/module/plugins/hooks/ExpertDecoders.py +++ b/module/plugins/hooks/ExpertDecoders.py @@ -56,7 +56,7 @@ class ExpertDecoders(Hook): data = f.read() req = get_request() - # raise timeout threshold + #: Raise timeout threshold req.c.setopt(pycurl.LOW_SPEED_TIME, 80) try: diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 9ca7bf854..ad9f67a1a 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -23,7 +23,7 @@ if sys.version_info < (2, 7) and os.name != "nt": raise - #: unsued timeout option for older python version + #: Unsued timeout option for older python version def wait(self, timeout=0): """ Wait for child process to terminate. Returns returncode @@ -36,8 +36,8 @@ if sys.version_info < (2, 7) and os.name != "nt": except OSError, e: if e.errno != errno.ECHILD: raise - #: This happens if SIGCLD is set to be ignored or waiting - #: for child processes has otherwise been disabled for our + #: This happens if SIGCLD is set to be ignored or waiting + #: For child processes has otherwise been disabled for our #: process. This child is dead, we can't get the status. sts = 0 self._handle_exitstatus(sts) @@ -196,7 +196,7 @@ class ExtractArchive(Hook): packages = self.queue.get() while packages: - if self.last_package: #: called from allDownloadsProcessed + if self.last_package: #: Called from allDownloadsProcessed self.last_package = False if self.extract(packages, thread): #@NOTE: check only if all gone fine, no failed reporting for now self.manager.dispatchEvent("all_archives_extracted") @@ -205,7 +205,7 @@ class ExtractArchive(Hook): if self.extract(packages, thread): #@NOTE: check only if all gone fine, no failed reporting for now pass - packages = self.queue.get() #: check for packages added during extraction + packages = self.queue.get() #: Check for packages added during extraction self.extracting = False @@ -272,12 +272,12 @@ class ExtractArchive(Hook): if extensions: self.log_debug("Use for extensions: %s" % "|.".join(extensions)) - #: reload from txt file + #: Reload from txt file self.reload_passwords() download_folder = self.core.config.get("general", "download_folder") - #: iterate packages -> extractors -> targets + #: Iterate packages -> extractors -> targets for pid in ids: pypack = self.core.files.getPackage(pid) @@ -287,8 +287,8 @@ class ExtractArchive(Hook): self.log_info(_("Check package: %s") % pypack.name) - #: determine output folder - out = fs_join(download_folder, pypack.folder, destination, "") #: force trailing slash + #: Determine output folder + out = fs_join(download_folder, pypack.folder, destination, "") #: Force trailing slash if subfolder: out = fs_join(out, pypack.folder) @@ -299,9 +299,9 @@ class ExtractArchive(Hook): matched = False success = True files_ids = dict((pylink['name'],((fs_join(download_folder, pypack.folder, pylink['name'])), pylink['id'], out)) for pylink \ - in sorted(pypack.getChildren().itervalues(), key=lambda k: k['name'])).values() #: remove duplicates + in sorted(pypack.getChildren().itervalues(), key=lambda k: k['name'])).values() #: Remove duplicates - #: check as long there are unseen files + #: Check as long there are unseen files while files_ids: new_files_ids = [] @@ -351,7 +351,7 @@ class ExtractArchive(Hook): success = False continue - #: remove processed file and related multiparts from list + #: Remove processed file and related multiparts from list files_ids = [(fname, fid, fout) for fname, fid, fout in files_ids \ if fname not in archive.getDeleteFiles()] self.log_debug("Extracted files: %s" % new_files) @@ -364,11 +364,11 @@ class ExtractArchive(Hook): continue if recursive and os.path.isfile(file): - new_files_ids.append((filename, fid, os.path.dirname(filename))) #: append as new target + new_files_ids.append((filename, fid, os.path.dirname(filename))) #: Append as new target self.manager.dispatchEvent("archive_extracted", pyfile, archive) - files_ids = new_files_ids #: also check extracted files + files_ids = new_files_ids #: Also check extracted files if matched: if success: diff --git a/module/plugins/hooks/IRCInterface.py b/module/plugins/hooks/IRCInterface.py index 32597aa42..5d8376b4e 100644 --- a/module/plugins/hooks/IRCInterface.py +++ b/module/plugins/hooks/IRCInterface.py @@ -84,7 +84,7 @@ class IRCInterface(Thread, Hook): def run(self): - #: connect to IRC etc. + #: Connect to IRC etc. self.sock = socket.socket() host = self.get_config('host') self.sock.connect((host, self.get_config('port'))) @@ -339,12 +339,12 @@ class IRCInterface(Thread, Hook): if not pack: return ["ERROR: Package doesn't exists."] - # TODO add links + #@TODO: add links return ["INFO: Added %d links to Package %s [#%d]" % (len(links), pack['name'], id)] except Exception: - #: create new package + #: Create new package id = self.core.api.addPackage(pack, links, 1) return ["INFO: Created new Package %s [#%d] with %d links." % (pack, id, len(links))] diff --git a/module/plugins/hooks/ImageTyperz.py b/module/plugins/hooks/ImageTyperz.py index 5e2f21c8b..b46728a0d 100644 --- a/module/plugins/hooks/ImageTyperz.py +++ b/module/plugins/hooks/ImageTyperz.py @@ -75,7 +75,7 @@ class ImageTyperz(Hook): def submit(self, captcha, captchaType="file", match=None): req = get_request() - # raise timeout threshold + #: Raise timeout threshold req.c.setopt(pycurl.LOW_SPEED_TIME, 80) try: diff --git a/module/plugins/hooks/RestartFailed.py b/module/plugins/hooks/RestartFailed.py index e19705d31..52752861f 100644 --- a/module/plugins/hooks/RestartFailed.py +++ b/module/plugins/hooks/RestartFailed.py @@ -41,5 +41,5 @@ class RestartFailed(Hook): def activate(self): - #: self.plugin_config_changed(self.__name__, "interval", self.get_config('interval')) + # self.plugin_config_changed(self.__name__, "interval", self.get_config('interval')) self.interval = max(self.MIN_CHECK_INTERVAL, self.get_config('interval') * 60) diff --git a/module/plugins/hooks/SkipRev.py b/module/plugins/hooks/SkipRev.py index 9f5f4f231..5ec6290ac 100644 --- a/module/plugins/hooks/SkipRev.py +++ b/module/plugins/hooks/SkipRev.py @@ -73,7 +73,7 @@ class SkipRev(Hook): queued = [True for link in self.core.api.getPackageData(pyfile.package().id).links \ if link.status not in status_list and pyname.match(link.name)].count(True) - if not queued or queued < revtokeep: #: keep one rev at least in auto mode + if not queued or queued < revtokeep: #: Keep one rev at least in auto mode return pyfile.setCustomStatus("SkipRev", "skipped") diff --git a/module/plugins/hooks/UnSkipOnFail.py b/module/plugins/hooks/UnSkipOnFail.py index 4e1e60f61..5507cd20f 100644 --- a/module/plugins/hooks/UnSkipOnFail.py +++ b/module/plugins/hooks/UnSkipOnFail.py @@ -35,13 +35,13 @@ class UnSkipOnFail(Hook): if link: self.log_info(_("Queue found duplicate: %s (pid:%s)") % (link.name, link.packageID)) - # Change status of "link" to "new_status". - # "link" has to be a valid FileData object, - # "new_status" has to be a valid status name - # (i.e. "queued" for this Plugin) - # It creates a temporary PyFile object using - # "link" data, changes its status, and tells - # the core.files-manager to save its data. + #: Change status of "link" to "new_status". + #: "link" has to be a valid FileData object, + #: "new_status" has to be a valid status name + #: (i.e. "queued" for this Plugin) + #: It creates a temporary PyFile object using + #: "link" data, changes its status, and tells + #: The core.files-manager to save its data. pylink = self._pyfile(link) pylink.setCustomStatus(_("unskipped"), "queued") @@ -63,22 +63,22 @@ class UnSkipOnFail(Hook): the data for "pyfile" iotselöf. It does MOT check the link's status. """ - queue = self.core.api.getQueue() #: get packages (w/o files, as most file data is useless here) + queue = self.core.api.getQueue() #: Get packages (w/o files, as most file data is useless here) for package in queue: - #: check if package-folder equals pyfile's package folder + #: Check if package-folder equals pyfile's package folder if package.folder != pyfile.package().folder: continue - #: now get packaged data w/ files/links + #: Now get packaged data w/ files/links pdata = self.core.api.getPackageData(package.pid) for link in pdata.links: - #: check if link is "skipped" + #: Check if link is "skipped" if link.status != 4: continue - #: check if link name collides with pdata's name - #: AND at last check if it is not pyfile itself + #: Check if link name collides with pdata's name + #: and at last check if it is not pyfile itself if link.name == pyfile.name and link.fid != pyfile.id: return link diff --git a/module/plugins/hooks/UpdateManager.py b/module/plugins/hooks/UpdateManager.py index 50e818c66..6f6ad9838 100644 --- a/module/plugins/hooks/UpdateManager.py +++ b/module/plugins/hooks/UpdateManager.py @@ -61,7 +61,7 @@ class UpdateManager(Hook): def setup(self): self.info = {'pyload': False, 'version': None, 'plugins': False, 'last_check': time.time()} - self.mtimes = {} #: store modification time for each plugin + self.mtimes = {} #: Store modification time for each plugin self.event_map = {'allDownloadsProcessed': "all_downloads_processed"} @@ -182,11 +182,11 @@ class UpdateManager(Hook): self.info['version'] = data[0] exitcode = 3 - # Exit codes: - # -1 = No plugin updated, new pyLoad version available - # 0 = No plugin updated - # 1 = Plugins updated - # 2 = Plugins updated, but restart required + #: Exit codes: + #: -1 = No plugin updated, new pyLoad version available + #: 0 = No plugin updated + #: 1 = Plugins updated + #: 2 = Plugins updated, but restart required return exitcode @@ -294,10 +294,10 @@ class UpdateManager(Hook): else: self.log_info(_("No plugin updates available")) - # Exit codes: - # 0 = No plugin updated - # 1 = Plugins updated - # 2 = Plugins updated, but restart required + #: Exit codes: + #: 0 = No plugin updated + #: 1 = Plugins updated + #: 2 = Plugins updated, but restart required return exitcode @@ -350,4 +350,4 @@ class UpdateManager(Hook): id = (type, name) removed.add(id) - return list(removed) #: return a list of the plugins successfully removed + return list(removed) #: Return a list of the plugins successfully removed diff --git a/module/plugins/hooks/XFileSharingPro.py b/module/plugins/hooks/XFileSharingPro.py index 9c42d1c0a..45acc9976 100644 --- a/module/plugins/hooks/XFileSharingPro.py +++ b/module/plugins/hooks/XFileSharingPro.py @@ -34,12 +34,12 @@ class XFileSharingPro(Hook): "junkyvideo.com", "linestorage.com", "ravishare.com", "ryushare.com", "salefiles.com", "sendmyway.com", "sharebeast.com", "sharesix.com", "thefile.me", "verzend.be", "worldbytez.com", "xvidstage.com", - # NOT TESTED: + #: NOT TESTED: "101shared.com", "4upfiles.com", "filemaze.ws", "filenuke.com", "linkzhost.com", "mightyupload.com", "rockdizfile.com", "sharerepo.com", "shareswift.com", "uploadbaz.com", "uploadc.com", "vidbull.com", "zalaa.com", "zomgupload.com", - # NOT WORKING: + #: NOT WORKING: "amonshare.com", "banicrazy.info", "boosterking.com", "host4desi.com", "laoupload.com", "rd-fs.com"] CRYPTER_BUILTIN = ["junocloud.me", "rapidfileshare.net"] @@ -105,7 +105,7 @@ class XFileSharingPro(Hook): def deactivate(self): - #: self.unload_hoster("BasePlugin") + # self.unload_hoster("BasePlugin") for type, plugin in (("hoster", "XFileSharingPro"), ("crypter", "XFileSharingProFolder")): self._unload(type, plugin) diff --git a/module/plugins/hooks/XMPPInterface.py b/module/plugins/hooks/XMPPInterface.py index a2c32166f..4262d3034 100644 --- a/module/plugins/hooks/XMPPInterface.py +++ b/module/plugins/hooks/XMPPInterface.py @@ -36,7 +36,7 @@ class XMPPInterface(IRCInterface, JabberClient): self.jid = JID(self.get_config('jid')) password = self.get_config('pw') - #: if bare JID is provided add a resource -- it is required + #: If bare JID is provided add a resource -- it is required if not self.jid.resource: self.jid = JID(self.jid.node, self.jid.domain, "pyLoad") @@ -47,8 +47,8 @@ class XMPPInterface(IRCInterface, JabberClient): tls_settings = None auth = ("sasl:DIGEST-MD5", "digest") - #: setup client with provided connection information - #: and identity data + #: Setup client with provided connection information + #: And identity data JabberClient.__init__(self, self.jid, password, disco_name="pyLoad XMPP Client", disco_type="bot", tls_settings=tls_settings, auth_methods=auth) @@ -83,7 +83,7 @@ class XMPPInterface(IRCInterface, JabberClient): def run(self): - #: connect to IRC etc. + #: Connect to IRC etc. self.connect() try: self.loop() 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)) diff --git a/module/plugins/internal/Account.py b/module/plugins/internal/Account.py index 951d279be..534f5607d 100644 --- a/module/plugins/internal/Account.py +++ b/module/plugins/internal/Account.py @@ -28,12 +28,12 @@ class Account(Plugin): self.manager = manager self.accounts = {} - self.infos = {} #: cache for account information + self.infos = {} #: Cache for account information self.lock = threading.RLock() self.timestamps = {} - self.login_timeout = 10 * 60 #: after that time (in minutes) pyload will relogin the account - self.info_threshold = 10 * 60 #: after that time (in minutes) account data will be reloaded + self.login_timeout = 10 * 60 #: After that time (in minutes) pyload will relogin the account + self.info_threshold = 10 * 60 #: After that time (in minutes) account data will be reloaded self.init() @@ -57,7 +57,7 @@ class Account(Plugin): @lock def _login(self, user, data): - #: set timestamp for login + #: Set timestamp for login self.timestamps[user] = time.time() self.req = self.get_account_request(user) @@ -96,7 +96,7 @@ class Account(Plugin): req.close() if user in self.infos: - del self.infos[user] #: delete old information + del self.infos[user] #: Delete old information return self._login(user, self.accounts[user]) @@ -113,7 +113,7 @@ class Account(Plugin): Updates account and return true if anything changed """ if user in self.accounts: - self.accounts[user]['valid'] = True #: do not remove or accounts will not login + self.accounts[user]['valid'] = True #: Do not remove or accounts will not login if password: self.accounts[user]['password'] = password self.relogin(user) @@ -210,13 +210,13 @@ class Account(Plugin): """ return {"validuntil" : None, #: -1 for unlimited "login" : name, - #: "password" : self.accounts[name]['password'], #: commented due security reason + # "password" : self.accounts[name]['password'], #: Commented due security reason "options" : self.accounts[name]['options'], "valid" : self.accounts[name]['valid'], - "trafficleft": None, #: in bytes, -1 for unlimited + "trafficleft": None, #: In bytes, -1 for unlimited "maxtraffic" : None, "premium" : None, - "timestamp" : 0, #: time this info was retrieved + "timestamp" : 0, #: Time this info was retrieved "type" : self.__name__} @@ -289,7 +289,7 @@ class Account(Plugin): return self.select_account() != (None, None) - def parse_traffic(self, value, unit=None): #: return kilobytes + def parse_traffic(self, value, unit=None): #: Return kilobytes if not unit and not isinstance(value, basestring): unit = "KB" return parse_size(value, unit) diff --git a/module/plugins/internal/AdYouLike.py b/module/plugins/internal/AdYouLike.py index 9036b4632..64ce6e7fa 100644 --- a/module/plugins/internal/AdYouLike.py +++ b/module/plugins/internal/AdYouLike.py @@ -28,7 +28,7 @@ class AdYouLike(Captcha): if m and n: self.key = (m.group(1).strip(), n.group(1).strip()) self.log_debug("Ayl: %s | Callback: %s" % self.key) - return self.key #: key is the tuple(ayl, callback) + return self.key #: Key is the tuple(ayl, callback) else: self.log_warning(_("Ayl or callback pattern not found")) return None diff --git a/module/plugins/internal/AdsCaptcha.py b/module/plugins/internal/AdsCaptcha.py index 788b5e71a..5f4dbaa86 100644 --- a/module/plugins/internal/AdsCaptcha.py +++ b/module/plugins/internal/AdsCaptcha.py @@ -26,7 +26,7 @@ class AdsCaptcha(Captcha): m = re.search(self.PUBLICKEY_PATTERN, html) n = re.search(self.CAPTCHAID_PATTERN, html) if m and n: - self.key = (m.group(1).strip(), n.group(1).strip()) #: key is the tuple(PublicKey, CaptchaId) + self.key = (m.group(1).strip(), n.group(1).strip()) #: Key is the tuple(PublicKey, CaptchaId) self.log_debug("Key: %s | ID: %s" % self.key) return self.key else: diff --git a/module/plugins/internal/Captcha.py b/module/plugins/internal/Captcha.py index 50ebea89c..68d5d3bb8 100644 --- a/module/plugins/internal/Captcha.py +++ b/module/plugins/internal/Captcha.py @@ -17,7 +17,7 @@ class Captcha(Plugin): super(Captcha, self).__init__(plugin.core) self.plugin = plugin - self.key = None #: last key detected + self.key = None #: Last key detected #@TODO: Recheck in 0.4.10 diff --git a/module/plugins/internal/Crypter.py b/module/plugins/internal/Crypter.py index f6d3528fd..dbecb0cf8 100644 --- a/module/plugins/internal/Crypter.py +++ b/module/plugins/internal/Crypter.py @@ -20,7 +20,7 @@ class Crypter(Hoster): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - html = None #: last html loaded #@TODO: Move to Hoster + html = None #: Last html loaded #@TODO: Move to Hoster def __init__(self, pyfile): diff --git a/module/plugins/internal/Hook.py b/module/plugins/internal/Hook.py index 7ef8f0189..162c9ecbf 100644 --- a/module/plugins/internal/Hook.py +++ b/module/plugins/internal/Hook.py @@ -43,7 +43,7 @@ class Hook(Plugin): #: `HookManager` self.manager = manager - #: automatically register event listeners for functions, attribute will be deleted dont use it yourself + #: Automatically register event listeners for functions, attribute will be deleted dont use it yourself self.event_map = {} #: Deprecated alternative to event_map @@ -68,7 +68,7 @@ class Hook(Plugin): else: self.manager.addEvent(event, getattr(self, funcs)) - #: delete for various reasons + #: Delete for various reasons self.event_map = None if self.event_list: diff --git a/module/plugins/internal/Hoster.py b/module/plugins/internal/Hoster.py index 637d9f3b5..c0e374a86 100644 --- a/module/plugins/internal/Hoster.py +++ b/module/plugins/internal/Hoster.py @@ -28,7 +28,7 @@ def parse_fileInfo(klass, url="", html=""): #@TODO: Remove in 0.4.10 def getInfo(urls): - # result = [ .. (name, size, status, url) .. ] + #: result = [ .. (name, size, status, url) .. ] pass @@ -62,14 +62,14 @@ class Hoster(Plugin): def __init__(self, pyfile): super(Hoster, self).__init__(pyfile.m.core) - #: engage wan reconnection + #: Engage wan reconnection self.want_reconnect = False - #: enable simultaneous processing of multiple downloads + #: Enable simultaneous processing of multiple downloads self.multi_dl = True self.limit_dl = 0 - #: chunk limit + #: Chunk limit self.chunk_limit = 1 self.resume_download = False @@ -77,13 +77,13 @@ class Hoster(Plugin): self.wait_until = 0 self.waiting = False - #: captcha reader instance + #: Captcha reader instance self.ocr = None - #: account handler instance, see :py:class:`Account` + #: Account handler instance, see :py:class:`Account` self.account = pyfile.m.core.accountManager.getAccountPlugin(self.__name__) - #: premium status + #: Premium status self.premium = False #: username/login @@ -97,37 +97,37 @@ class Hoster(Plugin): #: Browser instance, see `network.Browser` self.req = self.account.get_account_request(self.user) - self.chunk_limit = -1 #: chunk limit, -1 for unlimited + self.chunk_limit = -1 #: Chunk limit, -1 for unlimited - #: enables resume (will be ignored if server dont accept chunks) + #: Enables resume (will be ignored if server dont accept chunks) self.resume_download = True - #: premium status + #: Premium status self.premium = self.account.is_premium(self.user) else: self.req = pyfile.m.core.requestFactory.getRequest(self.__name__) - #: associated pyfile instance, see `PyFile` + #: Associated pyfile instance, see `PyFile` self.pyfile = pyfile - self.thread = None #: holds thread in future + self.thread = None #: Holds thread in future - #: location where the last call to download was saved + #: Location where the last call to download was saved self.last_download = "" - #: re match of the last call to `checkDownload` + #: Re match of the last call to `checkDownload` self.last_check = None - #: js engine, see `JsEngine` + #: Js engine, see `JsEngine` self.js = self.core.js - #: captcha task + #: Captcha task self.c_task = None - #: some plugins store html code here + #: Some plugins store html code here self.html = None - #: dict of the amount of retries already made + #: Dict of the amount of retries already made self.retries = {} self.init() @@ -392,7 +392,7 @@ class Hoster(Plugin): captchaManager.removeTask(task) - if task.error and has_plugin: #: ignore default error message since the user could use OCR + if task.error and has_plugin: #: Ignore default error message since the user could use OCR self.fail(_("Pil and tesseract not installed and no Client connected for captcha decrypting")) elif task.error: self.fail(task.error) @@ -471,7 +471,7 @@ class Hoster(Plugin): except Exception, e: self.fail(e) - #: convert back to unicode + #: Convert back to unicode location = fs_decode(location) name = safe_filename(self.pyfile.name) @@ -555,8 +555,8 @@ class Hoster(Plugin): with open(lastDownload, "rb") as f: content = f.read(read_size) - #: produces encoding errors, better log to other file in the future? - #: self.log_debug("Content: %s" % content) + #: Produces encoding errors, better log to other file in the future? + # self.log_debug("Content: %s" % content) for name, rule in rules.iteritems(): if isinstance(rule, basestring): if rule in content: @@ -699,9 +699,9 @@ class Hoster(Plugin): for pyfile in self.core.files.cache.values(): if pyfile != self.pyfile and pyfile.name == self.pyfile.name and pyfile.package().folder == pack.folder: - if pyfile.status in (0, 12): #: finished or downloading + if pyfile.status in (0, 12): #: Finished or downloading self.skip(pyfile.pluginname) - elif pyfile.status in (5, 7) and starting: #: a download is waiting/starting and was appenrently started before + elif pyfile.status in (5, 7) and starting: #: A download is waiting/starting and was appenrently started before self.skip(pyfile.pluginname) download_folder = self.core.config.get("general", "download_folder") diff --git a/module/plugins/internal/MultiHook.py b/module/plugins/internal/MultiHook.py index 7afe95705..4a43e89c7 100644 --- a/module/plugins/internal/MultiHook.py +++ b/module/plugins/internal/MultiHook.py @@ -207,7 +207,7 @@ class MultiHook(Hook): self.log_error(_("No %s loaded") % self.plugintype) return - #: inject plugin plugin + #: Inject plugin plugin self.log_debug("Overwritten %ss: %s" % (self.plugintype, ", ".join(sorted(self.supported)))) for plugin in self.supported: @@ -223,7 +223,7 @@ class MultiHook(Hook): self.log_debug("New %ss: %s" % (self.plugintype, ", ".join(plugins))) - #: create new regexp + #: Create new regexp regexp = r'.*(?P<DOMAIN>%s).*' % "|".join(x.replace('.', '\.') for x in plugins) if hasattr(self.pluginclass, "__pattern__") and isinstance(self.pluginclass.__pattern__, basestring) and "://" in self.pluginclass.__pattern__: regexp = r'%s|%s' % (self.pluginclass.__pattern__, regexp) @@ -252,7 +252,7 @@ class MultiHook(Hook): for plugin in self.supported: self.unload_plugin(plugin) - #: reset pattern + #: Reset pattern hdict = self.core.pluginManager.plugins[self.plugintype][self.pluginname] hdict['pattern'] = getattr(self.pluginclass, "__pattern__", r'^unmatchable$') diff --git a/module/plugins/internal/OCR.py b/module/plugins/internal/OCR.py index 880f8b570..9ddca0315 100644 --- a/module/plugins/internal/OCR.py +++ b/module/plugins/internal/OCR.py @@ -61,12 +61,12 @@ class OCR(Plugin): def run_tesser(self, subset=False, digits=True, lowercase=True, uppercase=True, pagesegmode=None): - #: tmpTif = tempfile.NamedTemporaryFile(suffix=".tif") + # tmpTif = tempfile.NamedTemporaryFile(suffix=".tif") try: tmpTif = open(fs_join("tmp", "tmpTif_%s.tif" % self.__name__), "wb") tmpTif.close() - #: tmpTxt = tempfile.NamedTemporaryFile(suffix=".txt") + # tmpTxt = tempfile.NamedTemporaryFile(suffix=".txt") tmpTxt = open(fs_join("tmp", "tmpTxt_%s.txt" % self.__name__), "wb") tmpTxt.close() @@ -88,7 +88,7 @@ class OCR(Plugin): tessparams.extend(["-psm", str(pagesegmode)]) if subset and (digits or lowercase or uppercase): - #: tmpSub = tempfile.NamedTemporaryFile(suffix=".subset") + # tmpSub = tempfile.NamedTemporaryFile(suffix=".subset") with open(fs_join("tmp", "tmpSub_%s.subset" % self.__name__), "wb") as tmpSub: tmpSub.write("tessedit_char_whitelist ") @@ -177,12 +177,12 @@ class OCR(Plugin): except Exception: pass - #: not enough neighbors are dark pixels so mark this pixel - #: to be changed to white + #: Not enough neighbors are dark pixels so mark this pixel + #: To be changed to white if count < allowed: pixels[x, y] = 1 - #: second pass: this time set all 1's to 255 (white) + #: Second pass: this time set all 1's to 255 (white) for x in xrange(w): for y in xrange(h): if pixels[x, y] == 1: diff --git a/module/plugins/internal/Plugin.py b/module/plugins/internal/Plugin.py index dc5995e65..51f952b40 100644 --- a/module/plugins/internal/Plugin.py +++ b/module/plugins/internal/Plugin.py @@ -69,7 +69,7 @@ def parse_html_form(attr_str, html, input_names={}): inputs[name] = value if input_names: - #: check input attributes + #: Check input attributes for key, val in input_names.iteritems(): if key in inputs: if isinstance(val, basestring) and inputs[key] == val: @@ -78,16 +78,16 @@ def parse_html_form(attr_str, html, input_names={}): continue elif hasattr(val, "search") and re.match(val, inputs[key]): continue - break #: attibute value does not match + break #: Attibute value does not match else: - break #: attibute name does not match + break #: Attibute name does not match else: - return action, inputs #: passed attribute check + return action, inputs #: Passed attribute check else: - #: no attribute check + #: No attribute check return action, inputs - return {}, None #: no matching form found + return {}, None #: No matching form found #@TODO: Move to utils in 0.4.10 @@ -303,13 +303,13 @@ class Plugin(object): os.makedirs(os.path.join("tmp", self.__name__)) with open(framefile, "wb") as f: - del frame #: delete the frame or it wont be cleaned + del frame #: Delete the frame or it wont be cleaned f.write(res.encode('utf8')) except IOError, e: self.log_error(e) if just_header: - #: parse header + #: Parse header header = {"code": req.code} for line in res.splitlines(): line = line.strip() diff --git a/module/plugins/internal/SevenZip.py b/module/plugins/internal/SevenZip.py index d067468dd..c76ef43e2 100644 --- a/module/plugins/internal/SevenZip.py +++ b/module/plugins/internal/SevenZip.py @@ -72,7 +72,7 @@ class SevenZip(UnRar): p = self.call_cmd("l", "-slt", fs_encode(self.filename)) out, err = p.communicate() - #: check if output or error macthes the 'wrong password'-Regexp + #: Check if output or error macthes the 'wrong password'-Regexp if self.re_wrongpwd.search(out): raise PasswordError @@ -91,7 +91,7 @@ class SevenZip(UnRar): renice(p.pid, self.renice) - #: communicate and retrieve stderr + #: Communicate and retrieve stderr self._progress(p) err = p.stderr.read().strip() @@ -102,7 +102,7 @@ class SevenZip(UnRar): elif self.re_wrongcrc.search(err): raise CRCError(err) - else: #: raise error if anything is on stderr + else: #: Raise error if anything is on stderr raise ArchiveError(err) if p.returncode > 1: @@ -134,11 +134,11 @@ class SevenZip(UnRar): def call_cmd(self, command, *xargs, **kwargs): args = [] - # overwrite flag + #: Overwrite flag if self.overwrite: args.append("-y") - # set a password + #: Set a password if "password" in kwargs and kwargs['password']: args.append("-p%s" % kwargs['password']) else: diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 93008f16d..08f13f900 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -124,7 +124,7 @@ class SimpleHoster(Hoster): online = True if info['status'] is 2 else False try: - info['pattern'] = re.match(cls.__pattern__, url).groupdict() #: pattern groups will be saved here + info['pattern'] = re.match(cls.__pattern__, url).groupdict() #: Pattern groups will be saved here except Exception: info['pattern'] = {} diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py index 50c421e8d..abd94b4df 100644 --- a/module/plugins/internal/UnRar.py +++ b/module/plugins/internal/UnRar.py @@ -68,7 +68,7 @@ class UnRar(Extractor): cls.__name__ = "RAR" cls.REPAIR = True - except OSError: #: fallback to unrar + except OSError: #: Fallback to unrar p = subprocess.Popen([cls.CMD], stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = p.communicate() @@ -105,7 +105,7 @@ class UnRar(Extractor): if self.re_wrongcrc.search(err): raise CRCError(err) - #: output only used to check if passworded files are present + #: Output only used to check if passworded files are present for attr in self.re_filelist.findall(out): if attr[0].startswith("*"): raise PasswordError @@ -114,7 +114,7 @@ class UnRar(Extractor): def repair(self): p = self.call_cmd("rc", fs_encode(self.filename)) - #: communicate and retrieve stderr + #: Communicate and retrieve stderr self._progress(p) err = p.stderr.read().strip() if err or p.returncode: @@ -126,17 +126,17 @@ class UnRar(Extractor): s = "" while True: c = process.stdout.read(1) - #: quit loop on eof + #: Quit loop on eof if not c: break - #: reading a percentage sign -> set progress and restart + #: Reading a percentage sign -> set progress and restart if c == '%': self.notify_progress(int(s)) s = "" - #: not reading a digit -> therefore restart + #: Not reading a digit -> therefore restart elif c not in digits: s = "" - #: add digit to progressstring + #: Add digit to progressstring else: s += c @@ -148,7 +148,7 @@ class UnRar(Extractor): renice(p.pid, self.renice) - #: communicate and retrieve stderr + #: Communicate and retrieve stderr self._progress(p) err = p.stderr.read().strip() @@ -159,7 +159,7 @@ class UnRar(Extractor): elif self.re_wrongcrc.search(err): raise CRCError(err) - else: #: raise error if anything is on stderr + else: #: Raise error if anything is on stderr raise ArchiveError(err) if p.returncode: @@ -171,7 +171,7 @@ class UnRar(Extractor): def get_delete_files(self): dir, name = os.path.split(self.filename) - #: actually extracted file + #: Actually extracted file files = [self.filename] #: eventually Multipart Files @@ -190,7 +190,7 @@ class UnRar(Extractor): if "Cannot open" in err: raise ArchiveError(_("Cannot open file")) - if err.strip(): #: only log error at this point + if err.strip(): #: Only log error at this point self.manager.log_error(err.strip()) result = set() @@ -211,7 +211,7 @@ class UnRar(Extractor): def call_cmd(self, command, *xargs, **kwargs): args = [] - #: overwrite flag + #: Overwrite flag if self.overwrite: args.append("-o+") else: @@ -222,10 +222,10 @@ class UnRar(Extractor): for word in self.excludefiles: args.append("-x'%s'" % word.strip()) - #: assume yes on all queries + #: Assume yes on all queries args.append("-y") - #: set a password + #: Set a password if "password" in kwargs and kwargs['password']: args.append("-p%s" % kwargs['password']) else: diff --git a/module/plugins/internal/XFSAccount.py b/module/plugins/internal/XFSAccount.py index 4005b8e21..7ae6d816e 100644 --- a/module/plugins/internal/XFSAccount.py +++ b/module/plugins/internal/XFSAccount.py @@ -30,10 +30,10 @@ class XFSAccount(Account): VALID_UNTIL_PATTERN = r'Premium.[Aa]ccount expire:.*?(\d{1,2} [\w^_]+ \d{4})' TRAFFIC_LEFT_PATTERN = r'Traffic available today:.*?<b>\s*(?P<S>[\d.,]+|[Uu]nlimited)\s*(?:(?P<U>[\w^_]+)\s*)?</b>' - TRAFFIC_LEFT_UNIT = "MB" #: used only if no group <U> was found + TRAFFIC_LEFT_UNIT = "MB" #: Used only if no group <U> was found LEECH_TRAFFIC_PATTERN = r'Leech Traffic left:<b>.*?(?P<S>[\d.,]+|[Uu]nlimited)\s*(?:(?P<U>[\w^_]+)\s*)?</b>' - LEECH_TRAFFIC_UNIT = "MB" #: used only if no group <U> was found + LEECH_TRAFFIC_UNIT = "MB" #: Used only if no group <U> was found LOGIN_FAIL_PATTERN = r'Incorrect Login or Password|account was banned|Error<' @@ -87,7 +87,7 @@ class XFSAccount(Account): trafficleft = -1 else: premium = False - validuntil = None #: registered account type (not premium) + validuntil = None #: Registered account type (not premium) else: self.log_debug("VALID_UNTIL_PATTERN not found") diff --git a/module/plugins/internal/XFSHoster.py b/module/plugins/internal/XFSHoster.py index 9f8728512..d4810f8b7 100644 --- a/module/plugins/internal/XFSHoster.py +++ b/module/plugins/internal/XFSHoster.py @@ -47,7 +47,7 @@ class XFSHoster(SimpleHoster): SOLVEMEDIA_PATTERN = None FORM_PATTERN = None - FORM_INPUTS_MAP = None #: dict passed as input_names to parse_html_form + FORM_INPUTS_MAP = None #: Dict passed as input_names to parse_html_form def setup(self): @@ -123,7 +123,7 @@ class XFSHoster(SimpleHoster): if not self.account: self.fail(_("Only registered or premium users can use url leech feature")) - # only tested with easybytez.com + #: Only tested with easybytez.com self.html = self.load("http://www.%s/" % self.HOSTER_DOMAIN) action, inputs = self.parse_html_form() @@ -137,7 +137,7 @@ class XFSHoster(SimpleHoster): self.log_debug(action, inputs) - self.req.setOption("timeout", 600) #: wait for file to upload to easybytez.com + self.req.setOption("timeout", 600) #: Wait for file to upload to easybytez.com self.html = self.load(action, post=inputs) @@ -163,7 +163,7 @@ class XFSHoster(SimpleHoster): else: self.fail(stmsg) - # get easybytez.com link for uploaded file + #: Get easybytez.com link for uploaded file m = re.search(self.LINK_LEECH_PATTERN, self.html) if m is None: self.error(_("LINK_LEECH_PATTERN not found")) |