diff options
-rw-r--r-- | module/plugins/AccountManager.py | 8 | ||||
-rw-r--r-- | module/plugins/accounts/NoPremiumPl.py | 12 | ||||
-rw-r--r-- | module/plugins/accounts/RapideoPl.py | 12 | ||||
-rw-r--r-- | module/plugins/accounts/SmoozedCom.py | 10 | ||||
-rw-r--r-- | module/plugins/accounts/UploadableCh.py | 2 | ||||
-rw-r--r-- | module/plugins/accounts/WebshareCz.py | 2 | ||||
-rw-r--r-- | module/plugins/captcha/CircleCaptcha.py | 244 | ||||
-rw-r--r-- | module/plugins/captcha/LinksaveIn.py | 10 | ||||
-rw-r--r-- | module/plugins/crypter/LinkCryptWs.py | 2 | ||||
-rw-r--r-- | module/plugins/hooks/Captcha9Kw.py | 4 | ||||
-rw-r--r-- | module/plugins/hooks/DeleteFinished.py | 2 | ||||
-rw-r--r-- | module/plugins/hooks/NoPremiumPlHook.py | 2 | ||||
-rw-r--r-- | module/plugins/hooks/RapideoPlHook.py | 2 | ||||
-rw-r--r-- | module/plugins/hoster/MegaRapidoNet.py | 2 | ||||
-rw-r--r-- | module/plugins/hoster/NoPremiumPl.py | 22 | ||||
-rw-r--r-- | module/plugins/hoster/RapideoPl.py | 22 | ||||
-rw-r--r-- | module/plugins/hoster/SmoozedCom.py | 16 | ||||
-rw-r--r-- | module/plugins/hoster/ZippyshareCom.py | 2 | ||||
-rw-r--r-- | module/plugins/internal/SevenZip.py | 4 |
19 files changed, 190 insertions, 190 deletions
diff --git a/module/plugins/AccountManager.py b/module/plugins/AccountManager.py index fc521d36c..094641c76 100644 --- a/module/plugins/AccountManager.py +++ b/module/plugins/AccountManager.py @@ -125,10 +125,10 @@ class AccountManager(): f.write("\n") f.write(plugin+":\n") - for name,data in accounts.iteritems(): - f.write("\n\t%s:%s\n" % (name,data["password"]) ) - if data["options"]: - for option, values in data["options"].iteritems(): + for name, data in accounts.iteritems(): + f.write("\n\t%s:%s\n" % (name, data['password']) ) + if data['options']: + for option, values in data['options'].iteritems(): f.write("\t@%s %s\n" % (option, " ".join(values))) f.close() diff --git a/module/plugins/accounts/NoPremiumPl.py b/module/plugins/accounts/NoPremiumPl.py index 30822791b..01060250b 100644 --- a/module/plugins/accounts/NoPremiumPl.py +++ b/module/plugins/accounts/NoPremiumPl.py @@ -42,11 +42,11 @@ class NoPremiumPl(Account): premium = False valid_untill = -1 - if "expire" in result.keys() and result["expire"]: + if "expire" in result.keys() and result['expire']: premium = True - valid_untill = time.mktime(datetime.datetime.fromtimestamp(int(result["expire"])).timetuple()) + valid_untill = time.mktime(datetime.datetime.fromtimestamp(int(result['expire'])).timetuple()) - traffic_left = result["balance"] * 1024 + traffic_left = result['balance'] * 1024 return {'validuntil' : valid_untill, 'trafficleft': traffic_left, @@ -55,7 +55,7 @@ class NoPremiumPl(Account): def login(self, user, data, req): self._usr = user - self._pwd = hashlib.sha1(hashlib.md5(data["password"]).hexdigest()).hexdigest() + self._pwd = hashlib.sha1(hashlib.md5(data['password']).hexdigest()).hexdigest() self._req = req try: @@ -72,8 +72,8 @@ class NoPremiumPl(Account): def createAuthQuery(self): query = self.API_QUERY - query["username"] = self._usr - query["password"] = self._pwd + query['username'] = self._usr + query['password'] = self._pwd return query diff --git a/module/plugins/accounts/RapideoPl.py b/module/plugins/accounts/RapideoPl.py index 0fc934255..f5ce2e2b1 100644 --- a/module/plugins/accounts/RapideoPl.py +++ b/module/plugins/accounts/RapideoPl.py @@ -42,11 +42,11 @@ class RapideoPl(Account): premium = False valid_untill = -1 - if "expire" in result.keys() and result["expire"]: + if "expire" in result.keys() and result['expire']: premium = True - valid_untill = time.mktime(datetime.datetime.fromtimestamp(int(result["expire"])).timetuple()) + valid_untill = time.mktime(datetime.datetime.fromtimestamp(int(result['expire'])).timetuple()) - traffic_left = result["balance"] + traffic_left = result['balance'] return {'validuntil' : valid_untill, 'trafficleft': traffic_left, @@ -55,7 +55,7 @@ class RapideoPl(Account): def login(self, user, data, req): self._usr = user - self._pwd = hashlib.md5(data["password"]).hexdigest() + self._pwd = hashlib.md5(data['password']).hexdigest() self._req = req try: @@ -72,8 +72,8 @@ class RapideoPl(Account): def createAuthQuery(self): query = self.API_QUERY - query["username"] = self._usr - query["password"] = self._pwd + query['username'] = self._usr + query['password'] = self._pwd return query diff --git a/module/plugins/accounts/SmoozedCom.py b/module/plugins/accounts/SmoozedCom.py index 148818957..0b0d7ed74 100644 --- a/module/plugins/accounts/SmoozedCom.py +++ b/module/plugins/accounts/SmoozedCom.py @@ -44,13 +44,13 @@ class SmoozedCom(Account): 'premium' : False} else: #: Parse account info - info = {'validuntil' : float(status["data"]["user"]["user_premium"]), - 'trafficleft': max(0, status["data"]["traffic"][1] - status["data"]["traffic"][0]), - 'session' : status["data"]["session_key"], - 'hosters' : [hoster["name"] for hoster in status["data"]["hoster"]]} + info = {'validuntil' : float(status['data']['user']['user_premium']), + 'trafficleft': max(0, status['data']['traffic'][1] - status['data']['traffic'][0]), + 'session' : status['data']['session_key'], + 'hosters' : [hoster['name'] for hoster in status['data']['hoster']]} if info['validuntil'] < time.time(): - if float(status["data"]["user"].get("user_trial", 0)) > time.time(): + if float(status['data']['user'].get("user_trial", 0)) > time.time(): info['premium'] = True else: info['premium'] = False diff --git a/module/plugins/accounts/UploadableCh.py b/module/plugins/accounts/UploadableCh.py index b0def5600..2936a2a6b 100644 --- a/module/plugins/accounts/UploadableCh.py +++ b/module/plugins/accounts/UploadableCh.py @@ -25,7 +25,7 @@ class UploadableCh(Account): def login(self, user, data, req): html = self.load("http://www.uploadable.ch/login.php", post={'userName' : user, - 'userPassword' : data["password"], + 'userPassword' : data['password'], 'autoLogin' : "1", 'action__login': "normalLogin"}, req=req) diff --git a/module/plugins/accounts/WebshareCz.py b/module/plugins/accounts/WebshareCz.py index d0f5524a2..b1ecef3fd 100644 --- a/module/plugins/accounts/WebshareCz.py +++ b/module/plugins/accounts/WebshareCz.py @@ -49,7 +49,7 @@ class WebshareCz(Account): self.wrongPassword() salt = re.search('<salt>(.+)</salt>', salt).group(1) - password = hashlib.sha1(md5_crypt.encrypt(data["password"], salt=salt)).hexdigest() + password = hashlib.sha1(md5_crypt.encrypt(data['password'], salt=salt)).hexdigest() digest = hashlib.md5(user + ":Webshare:" + password).hexdigest() login = self.load("https://webshare.cz/api/login/", diff --git a/module/plugins/captcha/CircleCaptcha.py b/module/plugins/captcha/CircleCaptcha.py index 6c758d3de..c7a3a3fe9 100644 --- a/module/plugins/captcha/CircleCaptcha.py +++ b/module/plugins/captcha/CircleCaptcha.py @@ -46,8 +46,8 @@ class CircleCaptcha(OCR): def cleanImage(self, im, pix): cleandeep = 1 - imageheight = range(1,int(im.size[1])) - imagewidth = range(1,int(im.size[0])) + imageheight = xrange(1, int(im.size[1])) + imagewidth = xrange(1, int(im.size[0])) howmany = 0 curcolor = self.BACKGROUND @@ -55,45 +55,45 @@ class CircleCaptcha(OCR): jump = True howmany = 0 for x in imagewidth: - curpix = pix[x,y] + curpix = pix[x, y] if curpix > self.BACKGROUND: if howmany <= cleandeep and howmany > 0: #: clean pixel - for ic in range(1,cleandeep+1): + for ic in xrange(1, cleandeep+1): if x -ic > 0: - pix[x-ic,y] = self.BACKGROUND + 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 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 - pix[x-1,y] = self.BACKGROUND + pix[x-1, y] = self.BACKGROUND curcolor = self.BACKGROUND for x in imagewidth: jump = True howmany = 0 for y in imageheight: - curpix = pix[x,y] + curpix = pix[x, y] #: if jump == True: if curpix > self.BACKGROUND: if howmany <= cleandeep and howmany > 0: #: clean pixel - for ic in range(1,cleandeep+1): + for ic in xrange(1, cleandeep+1): #: raw_input('2'+str(ic)) if y-ic > 0: - pix[x,y-ic] = self.BACKGROUND + pix[x, y-ic] = self.BACKGROUND jump = False howmany = 0 curcolor = curpix @@ -109,19 +109,19 @@ class CircleCaptcha(OCR): howmany = howmany + 1 if howmany == 1: #: clean pixel - pix[x-1,y] = self.BACKGROUND + pix[x-1, y] = self.BACKGROUND #: return -1 def findFirstPixelX(self, im, pix, curx, cury, color = -1, ExitWithBlack = False): - imageheight = range(1,int(im.size[1])) - imagewidth = range(curx+1,int(im.size[0])) + imageheight = xrange(1, int(im.size[1])) + imagewidth = xrange(curx+1, int(im.size[0])) jump = True newx = (-1,-1) blackfound = 0 for x in imagewidth: - curpix = pix[x,cury] + curpix = pix[x, cury] if curpix < self.BLACKCOLOR: blackfound = blackfound + 1 @@ -146,12 +146,12 @@ class CircleCaptcha(OCR): def findLastPixelX(self, im, pix, curx, cury, color = -1, ExitWithBlack = False): - imageheight = range(1,int(im.size[1])) - imagewidth = range(curx+1,int(im.size[0])) + imageheight = xrange(1, int(im.size[1])) + imagewidth = xrange(curx+1, int(im.size[0])) newx = (-1,-1) blackfound = 0 for x in imagewidth: - curpix = pix[x,cury] + curpix = pix[x, cury] if curpix < self.BLACKCOLOR: blackfound = blackfound + 1 @@ -175,14 +175,14 @@ class CircleCaptcha(OCR): def findLastPixelY(self, im, pix, curx, cury, DownToUp, color = -1, ExitWithBlack = False): if DownToUp == False: - imageheight = range(int(cury)+1,int(im.size[1])-1) + imageheight = xrange(int(cury)+1, int(im.size[1])-1) else: - imageheight = range(int(cury)-1,1,-1) - imagewidth = range(int(curx),int(im.size[0])) + imageheight = xrange(int(cury)-1, 1,-1) + imagewidth = xrange(int(curx),int(im.size[0])) newy = (-1,-1) blackfound = 0 for y in imageheight: - curpix = pix[curx,y] + curpix = pix[curx, y] if curpix < self.BLACKCOLOR: blackfound = blackfound + 1 @@ -206,11 +206,11 @@ class CircleCaptcha(OCR): def findCircle(self, pix, x1, y1, x2, y2, x3, y3): #: trasposizione coordinate - #: A(0,0) B(x2-x1,y2-y1) C(x3-x1,y3-y1) + #: A(0, 0) B(x2-x1, y2-y1) C(x3-x1, y3-y1) #: x**2+y**2+ax+bx+c=0 - p1 = (0,0) - p2 = (x2-x1,y2-y1) - p3 = (x3-x1,y3-y1) + p1 = (0, 0) + p2 = (x2-x1, y2-y1) + p3 = (x3-x1, y3-y1) #: 1 c=0 @@ -229,7 +229,7 @@ class CircleCaptcha(OCR): cx=math.floor((-1*(a/2))+x1) cy=math.floor((-1*(b/2))+y1) - return cx,cy,r + return cx, cy, r def verifyCircleNew(self, im, pix, c): @@ -241,8 +241,8 @@ class CircleCaptcha(OCR): -1 -> Not found circle -2 -> Found black position then leave position """ - imageheight = range(int(c[1]-c[2]),int(c[1]+c[2])) - imagewidth = range(int(c[0]-c[2]),int(c[0]+c[2])) + imageheight = xrange(int(c[1]-c[2]),int(c[1]+c[2])) + imagewidth = xrange(int(c[0]-c[2]),int(c[0]+c[2])) min_ray = 15 max_ray = 30 @@ -269,21 +269,21 @@ class CircleCaptcha(OCR): return -2 cardinalpoints = 0 - if self.verifyPoint(im, pix,c[0] + c[2],c[1],True) == 1: + if self.verifyPoint(im, pix, c[0] + c[2],c[1],True) == 1: cardinalpoints = cardinalpoints + 1 - if self.verifyPoint(im, pix,c[0] + c[2],c[1],False) == -1: + if self.verifyPoint(im, pix, c[0] + c[2],c[1],False) == -1: return -2 - if self.verifyPoint(im, pix,c[0] - c[2],c[1],True) == 1: + if self.verifyPoint(im, pix, c[0] - c[2],c[1],True) == 1: cardinalpoints = cardinalpoints + 1 - if self.verifyPoint(im, pix,c[0] - c[2],c[1],False) == -1: + if self.verifyPoint(im, pix, c[0] - c[2],c[1],False) == -1: return -2 - if self.verifyPoint(im, pix,c[0],c[1] + c[2],True) == 1: + if self.verifyPoint(im, pix, c[0],c[1] + c[2],True) == 1: cardinalpoints = cardinalpoints + 1 - if self.verifyPoint(im, pix,c[0],c[1] + c[2],False) == -1: + if self.verifyPoint(im, pix, c[0],c[1] + c[2],False) == -1: return -2 - if self.verifyPoint(im, pix,c[0],c[1] - c[2],True) == 1: + if self.verifyPoint(im, pix, c[0],c[1] - c[2],True) == 1: cardinalpoints = cardinalpoints + 1 - if self.verifyPoint(im, pix,c[0],c[1] - c[2],False) == -1: + if self.verifyPoint(im, pix, c[0],c[1] - c[2],False) == -1: return -2 if cardinalpoints < 3: return -1 @@ -294,22 +294,22 @@ class CircleCaptcha(OCR): y2= int(round(c[1]+ math.sqrt(c[2]**2-(c[0]-x)**2))) howmany = howmany + 2 - if self.verifyPoint(im, pix, x,y,exactfind) == 0: + if self.verifyPoint(im, pix, x, y, exactfind) == 0: missing = missing + 1 - missinglist.append((x,y)) + missinglist.append((x, y)) else: - pointsofcircle.append((x,y)) + pointsofcircle.append((x, y)) - if self.verifyPoint(im, pix, x,y,False) == -1: + if self.verifyPoint(im, pix, x, y, False) == -1: return -2 - if self.verifyPoint(im, pix, x,y2,exactfind) == 0: + if self.verifyPoint(im, pix, x, y2, exactfind) == 0: missing = missing + 1 - missinglist.append((x,y2)) + missinglist.append((x, y2)) else: - pointsofcircle.append((x,y2)) + pointsofcircle.append((x, y2)) - if self.verifyPoint(im, pix, x,y2,False) == -1: + if self.verifyPoint(im, pix, x, y2, False) == -1: return -2 @@ -322,8 +322,8 @@ class CircleCaptcha(OCR): -1 -> Not found circle -2 -> Found black position then leave position """ - imageheight = range(int(c[1]-c[2]),int(c[1]+c[2])) - imagewidth = range(int(c[0]-c[2]),int(c[0]+c[2])) + imageheight = xrange(int(c[1]-c[2]),int(c[1]+c[2])) + imagewidth = xrange(int(c[0]-c[2]),int(c[0]+c[2])) min_ray = 15 max_ray = 30 @@ -350,21 +350,21 @@ class CircleCaptcha(OCR): return -2 cardinalpoints = 0 - if self.verifyPoint(im, pix,c[0] + c[2],c[1],True) == 1: + if self.verifyPoint(im, pix, c[0] + c[2],c[1],True) == 1: cardinalpoints = cardinalpoints + 1 - if self.verifyPoint(im, pix,c[0] + c[2],c[1],False) == -1: + if self.verifyPoint(im, pix, c[0] + c[2],c[1],False) == -1: return -2 - if self.verifyPoint(im, pix,c[0] - c[2],c[1],True) == 1: + if self.verifyPoint(im, pix, c[0] - c[2],c[1],True) == 1: cardinalpoints = cardinalpoints + 1 - if self.verifyPoint(im, pix,c[0] - c[2],c[1],False) == -1: + if self.verifyPoint(im, pix, c[0] - c[2],c[1],False) == -1: return -2 - if self.verifyPoint(im, pix,c[0],c[1] + c[2],True) == 1: + if self.verifyPoint(im, pix, c[0],c[1] + c[2],True) == 1: cardinalpoints = cardinalpoints + 1 - if self.verifyPoint(im, pix,c[0],c[1] + c[2],False) == -1: + if self.verifyPoint(im, pix, c[0],c[1] + c[2],False) == -1: return -2 - if self.verifyPoint(im, pix,c[0],c[1] - c[2],True) == 1: + if self.verifyPoint(im, pix, c[0],c[1] - c[2],True) == 1: cardinalpoints = cardinalpoints + 1 - if self.verifyPoint(im, pix,c[0],c[1] - c[2],False) == -1: + if self.verifyPoint(im, pix, c[0],c[1] - c[2],False) == -1: return -2 if cardinalpoints < 3: return -1 @@ -375,22 +375,22 @@ class CircleCaptcha(OCR): y2= int(round(c[1]+ math.sqrt(c[2]**2-(c[0]-x)**2))) howmany = howmany + 2 - if self.verifyPoint(im, pix, x,y,exactfind) == 0: + if self.verifyPoint(im, pix, x, y, exactfind) == 0: missing = missing + 1 - missinglist.append((x,y)) + missinglist.append((x, y)) else: - pointsofcircle.append((x,y)) + pointsofcircle.append((x, y)) - if self.verifyPoint(im, pix, x,y,False) == -1: + if self.verifyPoint(im, pix, x, y, False) == -1: return -2 - if self.verifyPoint(im, pix, x,y2,exactfind) == 0: + if self.verifyPoint(im, pix, x, y2, exactfind) == 0: missing = missing + 1 - missinglist.append((x,y2)) + missinglist.append((x, y2)) else: - pointsofcircle.append((x,y2)) + pointsofcircle.append((x, y2)) - if self.verifyPoint(im, pix, x,y2,False) == -1: + if self.verifyPoint(im, pix, x, y2, False) == -1: return -2 for y in imageheight: @@ -399,39 +399,39 @@ class CircleCaptcha(OCR): x2= int(round(c[0]+ math.sqrt(c[2]**2-(c[1]-y)**2))) howmany = howmany + 2 - if self.verifyPoint(im, pix, x,y,exactfind) == 0: + if self.verifyPoint(im, pix, x, y, exactfind) == 0: missing = missing + 1 - missinglist.append((x,y)) + missinglist.append((x, y)) else: - pointsofcircle.append((x,y)) + pointsofcircle.append((x, y)) - if self.verifyPoint(im, pix, x,y,False) == -1: + if self.verifyPoint(im, pix, x, y, False) == -1: return -2 - if self.verifyPoint(im, pix, x2,y,exactfind) == 0: + if self.verifyPoint(im, pix, x2, y, exactfind) == 0: missing = missing + 1 - missinglist.append((x2,y)) + missinglist.append((x2, y)) else: - pointsofcircle.append((x2,y)) + pointsofcircle.append((x2, y)) - if self.verifyPoint(im, pix, x2,y,exactfind) == -1: + if self.verifyPoint(im, pix, x2, y, exactfind) == -1: return -2 for p in missinglist: #: left and bottom if (self.verifyPoint(im, pix, p[0]-1, p[1],exactfind) == 1 and \ - self.verifyPoint(im, pix, p[0], p[1]+1,exactfind) == 1): + self.verifyPoint(im, pix, p[0], p[1]+1, exactfind) == 1): missing = missing - 1 elif (self.verifyPoint(im, pix, p[0]-1, p[1],exactfind) == 1 and \ - self.verifyPoint(im, pix, p[0], p[1]-1,exactfind) == 1): + self.verifyPoint(im, pix, p[0], p[1]-1, exactfind) == 1): missing = missing - 1 #: right and bottom elif (self.verifyPoint(im, pix, p[0]+1, p[1],exactfind) == 1 and \ - self.verifyPoint(im, pix, p[0], p[1]+1,exactfind) == 1): + self.verifyPoint(im, pix, p[0], p[1]+1, exactfind) == 1): missing = missing - 1 #: right and up elif (self.verifyPoint(im, pix, p[0]+1, p[1],exactfind) == 1 and \ - self.verifyPoint(im, pix, p[0], p[1]-1,exactfind) == 1): + self.verifyPoint(im, pix, p[0], p[1]-1, exactfind) == 1): missing = missing - 1 if (p[0], p[1]+1) in missinglist or \ @@ -498,7 +498,7 @@ class CircleCaptcha(OCR): return 1 - def verifyPoint(self, im, pix, x,y,exact,color = -1): + def verifyPoint(self, im, pix, x, y, exact, color = -1): #: Verify point result = 0 @@ -507,7 +507,7 @@ class CircleCaptcha(OCR): if y < 0 or y >= im.size[1]: return result - curpix = pix[x,y] + curpix = pix[x, y] if (curpix == color and color > -1) or (curpix < self.BACKGROUND and color == -1): if curpix > self.BLACKCOLOR: result = 1 @@ -517,7 +517,7 @@ class CircleCaptcha(OCR): #: Verify around if (exact == False): if x + 1 < im.size[0]: - curpix = pix[x+1,y] + curpix = pix[x+1, y] if (curpix == color and color > -1) or (curpix < self.BACKGROUND and color == -1): if curpix > self.BLACKCOLOR: result = 1 @@ -525,13 +525,13 @@ class CircleCaptcha(OCR): result = -1 if x > 0: - curpix = pix[x-1,y] + curpix = pix[x-1, y] if (curpix == color and color > -1) or (curpix < self.BACKGROUND and color == -1): if curpix > self.BLACKCOLOR: result = 1 if curpix <= self.BLACKCOLOR: result = -1 - #: print str((x,y)) + " = " + str(result) + #: print str((x, y)) + " = " + str(result) return result @@ -553,9 +553,9 @@ class CircleCaptcha(OCR): pix = im.load() - stepheight = range(1,im.size[1],2) - #: stepheight = range(45,47) - imagewidth = range(1,im.size[0]) + stepheight = xrange(1, im.size[1],2) + #: stepheight = xrange(45, 47) + imagewidth = xrange(1, im.size[0]) lstPoints = [] # Declares an empty list for the points lstX = [] # CoordinateX lstY = [] # CoordinateY @@ -579,7 +579,7 @@ class CircleCaptcha(OCR): for y1 in stepheight: x1 = 1 curcolor = -1 - for k in range(1,100): + for k in xrange(1, 100): findnewcircle = False retval = self.findFirstPixelX(im, pix, x1, y1, -1, False) x1 = retval[0] @@ -588,17 +588,17 @@ 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 (x1, y1) in self.pointsofcirclefound: + if self._DEBUG == True: print 'found ' + str((x1, y1)) continue - if self._DEBUG == True: pixcopy[x1,y1] = 45 #(255,0,0,255) - #: found 1 pixel, seeking x2,y2 + if self._DEBUG == True: pixcopy[x1, y1] = 45 #(255, 0, 0, 255) + #: found 1 pixel, seeking x2, y2 x2 = x1 y2 = y1 - for i in range(1,100): + for i in xrange(1, 100): retval = self.findLastPixelX(im, pix, x2, y2, -1, True) x2 = retval[0] if x1 == -2: @@ -606,7 +606,7 @@ 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): @@ -614,16 +614,16 @@ class CircleCaptcha(OCR): if abs(x2 - x1) > max_diameter: break - if self._DEBUG == True: pixcopy[x2,y2] = 65 #(0,255,0,255) - #: found 2 pixel, seeking x3,y3 + if self._DEBUG == True: pixcopy[x2, y2] = 65 #(0, 255, 0, 255) + #: found 2 pixel, seeking x3, y3 #: verify cord - for invert in range(0,2): + for invert in xrange(0, 2): x3 = math.floor(x2 - ((x2 - x1) / 2)) y3 = y1 - for j in range(1,50): + for j in xrange(1, 50): retval = self.findLastPixelY(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,7 +631,7 @@ class CircleCaptcha(OCR): if y3 == -1: break - if self._DEBUG == True: print "x3, y3 -> " + str((x3,y3)) + ": " + str(pix[x3,y3]) + if self._DEBUG == True: print "x3, y3 -> " + str((x3, y3)) + ": " + str(pix[x3, y3]) #: verify cord if abs(y3 - y2) < min_distance: continue @@ -640,9 +640,9 @@ class CircleCaptcha(OCR): if abs(y3 - y2) > max_diameter: break - if self._DEBUG == True: pixcopy[x3,y3] = 85 + if self._DEBUG == True: pixcopy[x3, y3] = 85 #: found 3 pixel. try circle - c = self.findCircle(pix, x1,y1,x2,y2,x3,y3) + c = self.findCircle(pix, x1, y1, x2, y2, x3, y3) if c[0] + c[2] >= im.size[0] or c[1] + c[2] >= im.size[1] or c[0] - c[2] <= 0 or c[1] - c[2] <= 0: continue @@ -697,40 +697,40 @@ class CircleCaptcha(OCR): if verify == 0: p = c[0] if ( - ((p[0], p[1]+1,p[2]),1) in found or \ - ((p[0], p[1]-1,p[2]),1) in found or \ + ((p[0], p[1]+1, p[2]),1) in found or \ + ((p[0], p[1]-1, p[2]),1) in found or \ ((p[0]+1, p[1],p[2]),1) in found or \ ((p[0]-1, p[1],p[2]),1) in found or \ - ((p[0]+1, p[1]+1,p[2]),1) in found or \ - ((p[0]-1, p[1]+1,p[2]),1) in found or \ - ((p[0]+1, p[1]-1,p[2]),1) in found or \ - ((p[0]-1, p[1]-1,p[2]),1) in found \ + ((p[0]+1, p[1]+1, p[2]),1) in found or \ + ((p[0]-1, p[1]+1, p[2]),1) in found or \ + ((p[0]+1, p[1]-1, p[2]),1) in found or \ + ((p[0]-1, p[1]-1, p[2]),1) in found \ ): #: delete nearly circle verify = -1 if ( - ((p[0], p[1]+1,p[2]+1),1) in found or \ - ((p[0], p[1]-1,p[2]+1),1) in found or \ + ((p[0], p[1]+1, p[2]+1),1) in found or \ + ((p[0], p[1]-1, p[2]+1),1) in found or \ ((p[0]+1, p[1],p[2]+1),1) in found or \ ((p[0]-1, p[1],p[2]+1),1) in found or \ - ((p[0]+1, p[1]+1,p[2]+1),1) in found or \ - ((p[0]-1, p[1]+1,p[2]+1),1) in found or \ - ((p[0]+1, p[1]-1,p[2]+1),1) in found or \ - ((p[0]-1, p[1]-1,p[2]+1),1) in found \ + ((p[0]+1, p[1]+1, p[2]+1),1) in found or \ + ((p[0]-1, p[1]+1, p[2]+1),1) in found or \ + ((p[0]+1, p[1]-1, p[2]+1),1) in found or \ + ((p[0]-1, p[1]-1, p[2]+1),1) in found \ ): #: delete nearly circle verify = -1 if ( - ((p[0], p[1]+1,p[2]-1),1) in found or \ - ((p[0], p[1]-1,p[2]-1),1) in found or \ + ((p[0], p[1]+1, p[2]-1),1) in found or \ + ((p[0], p[1]-1, p[2]-1),1) in found or \ ((p[0]+1, p[1],p[2]-1),1) in found or \ ((p[0]-1, p[1],p[2]-1),1) in found or \ - ((p[0]+1, p[1]+1,p[2]-1),1) in found or \ - ((p[0]-1, p[1]+1,p[2]-1),1) in found or \ - ((p[0]+1, p[1]-1,p[2]-1),1) in found or \ - ((p[0]-1, p[1]-1,p[2]-1),1) in found \ + ((p[0]+1, p[1]+1, p[2]-1),1) in found or \ + ((p[0]-1, p[1]+1, p[2]-1),1) in found or \ + ((p[0]+1, p[1]-1, p[2]-1),1) in found or \ + ((p[0]-1, p[1]-1, p[2]-1),1) in found \ ): #: delete nearly circle @@ -738,23 +738,23 @@ class CircleCaptcha(OCR): #: if verify == 0: #: if self._DEBUG == True: - #: pix[c[0][0],c[0][1]] = 90 #(255,255,0) + #: 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) + #: 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) + #: 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") - #: Return coordinates of opened circle (eg (x,y)) + #: Return coordinates of opened circle (eg (x, y)) def decrypt_from_web(self, url): file = cStringIO.StringIO(urllib.urlopen(url).read()) img = Image.open(file) @@ -762,7 +762,7 @@ class CircleCaptcha(OCR): print "Coords: " + str(coords) - #: Return coordinates of opened circle (eg (x,y)) + #: Return coordinates of opened circle (eg (x, y)) def decrypt_from_file(self, filename): coords = self.decrypt(Image.open(filename)) #: Can be many different formats. print "Coords: " + str(coords) diff --git a/module/plugins/captcha/LinksaveIn.py b/module/plugins/captcha/LinksaveIn.py index f5cfbc97b..7aeffbe79 100644 --- a/module/plugins/captcha/LinksaveIn.py +++ b/module/plugins/captcha/LinksaveIn.py @@ -31,7 +31,7 @@ class LinksaveIn(OCR): frame_nr = 0 lut = im.resize((256, 1)) - lut.putdata(range(256)) + lut.putdata(xrange(256)) lut = list(lut.convert("RGB").getdata()) new = Image.new("RGB", im.size) @@ -63,11 +63,11 @@ class LinksaveIn(OCR): bg = Image.open(bgpath) bglut = bg.resize((256, 1)) - bglut.putdata(range(256)) + bglut.putdata(xrange(256)) bglut = list(bglut.convert("RGB").getdata()) lut = img.resize((256, 1)) - lut.putdata(range(256)) + lut.putdata(xrange(256)) lut = list(lut.convert("RGB").getdata()) bgpix = bg.load() @@ -96,11 +96,11 @@ class LinksaveIn(OCR): img = self.image.convert("P") bglut = bg.resize((256, 1)) - bglut.putdata(range(256)) + bglut.putdata(xrange(256)) bglut = list(bglut.convert("RGB").getdata()) lut = img.resize((256, 1)) - lut.putdata(range(256)) + lut.putdata(xrange(256)) lut = list(lut.convert("RGB").getdata()) bgpix = bg.load() diff --git a/module/plugins/crypter/LinkCryptWs.py b/module/plugins/crypter/LinkCryptWs.py index b9abb08d2..e889ca154 100644 --- a/module/plugins/crypter/LinkCryptWs.py +++ b/module/plugins/crypter/LinkCryptWs.py @@ -234,7 +234,7 @@ class LinkCryptWs(Crypter): self.logDebug('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/hooks/Captcha9Kw.py b/module/plugins/hooks/Captcha9Kw.py index a67e5bfc3..7e9bd2071 100644 --- a/module/plugins/hooks/Captcha9Kw.py +++ b/module/plugins/hooks/Captcha9Kw.py @@ -139,7 +139,7 @@ class Captcha9Kw(Hook): self.logDebug("NewCaptchaID ticket: %s" % res, task.captchaFile) - task.data["ticket"] = res + task.data['ticket'] = res for _i in xrange(int(self.getConfig('timeout') / 5)): result = self.load(self.API_URL, @@ -232,7 +232,7 @@ class Captcha9Kw(Hook): 'correct': "1" if correct else "2", 'pyload' : "1", 'source' : "pyload", - 'id' : task.data["ticket"]}) + 'id' : task.data['ticket']}) self.logDebug("Request %s: %s" % (type, res)) diff --git a/module/plugins/hooks/DeleteFinished.py b/module/plugins/hooks/DeleteFinished.py index a3e171a43..a65e61547 100644 --- a/module/plugins/hooks/DeleteFinished.py +++ b/module/plugins/hooks/DeleteFinished.py @@ -30,7 +30,7 @@ class DeleteFinished(Hook): def periodical(self): if not self.info['sleep']: deloffline = self.getConfig('deloffline') - mode = '0,1,4' if deloffline else '0,4' + mode = "0,1,4" if deloffline else "0,4" msg = _('delete all finished packages in queue list (%s packages with offline links)') self.logInfo(msg % (_('including') if deloffline else _('excluding'))) self.deleteFinished(mode) diff --git a/module/plugins/hooks/NoPremiumPlHook.py b/module/plugins/hooks/NoPremiumPlHook.py index 264f3462a..d0527d297 100644 --- a/module/plugins/hooks/NoPremiumPlHook.py +++ b/module/plugins/hooks/NoPremiumPlHook.py @@ -22,7 +22,7 @@ class NoPremiumPlHook(MultiHook): def getHosters(self): hostings = json_loads(self.load("https://www.nopremium.pl/clipboard.php?json=3").strip()) - hostings_domains = [domain for row in hostings for domain in row["domains"] if row["sdownload"] == "0"] + hostings_domains = [domain for row in hostings for domain in row['domains'] if row['sdownload'] == "0"] self.logDebug(hostings_domains) diff --git a/module/plugins/hooks/RapideoPlHook.py b/module/plugins/hooks/RapideoPlHook.py index f498def2a..3509f043c 100644 --- a/module/plugins/hooks/RapideoPlHook.py +++ b/module/plugins/hooks/RapideoPlHook.py @@ -22,7 +22,7 @@ class RapideoPlHook(MultiHook): def getHosters(self): hostings = json_loads(self.load("https://www.rapideo.pl/clipboard.php?json=3").strip()) - hostings_domains = [domain for row in hostings for domain in row["domains"] if row["sdownload"] == "0"] + hostings_domains = [domain for row in hostings for domain in row['domains'] if row['sdownload'] == "0"] self.logDebug(hostings_domains) diff --git a/module/plugins/hoster/MegaRapidoNet.py b/module/plugins/hoster/MegaRapidoNet.py index ee0948bf1..ce31308d0 100644 --- a/module/plugins/hoster/MegaRapidoNet.py +++ b/module/plugins/hoster/MegaRapidoNet.py @@ -8,7 +8,7 @@ from module.plugins.internal.MultiHoster import MultiHoster def random_with_N_digits(n): rand = "0." not_zero = 0 - for i in range(1, n + 1): + for i in xrange(1, n + 1): r = random.randint(0, 9) if(r > 0): not_zero += 1 diff --git a/module/plugins/hoster/NoPremiumPl.py b/module/plugins/hoster/NoPremiumPl.py index ec3699a08..29de7cc77 100644 --- a/module/plugins/hoster/NoPremiumPl.py +++ b/module/plugins/hoster/NoPremiumPl.py @@ -46,9 +46,9 @@ class NoPremiumPl(MultiHoster): def runFileQuery(self, url, mode=None): query = self.API_QUERY.copy() - query["username"] = self.usr - query["password"] = self.pwd - query["url"] = url + query['username'] = self.usr + query['password'] = self.pwd + query['url'] = url if mode == "fileinfo": query['check'] = 2 @@ -77,24 +77,24 @@ class NoPremiumPl(MultiHoster): self.logDebug(parsed) if "errno" in parsed.keys(): - if parsed["errno"] in self.ERROR_CODES: + if parsed['errno'] in self.ERROR_CODES: #: error code in known - self.fail(self.ERROR_CODES[parsed["errno"]] % self.__name__) + self.fail(self.ERROR_CODES[parsed['errno']] % self.__name__) else: #: error code isn't yet added to plugin self.fail( - parsed["errstring"] - or _("Unknown error (code: %s)") % parsed["errno"] + parsed['errstring'] + or _("Unknown error (code: %s)") % parsed['errno'] ) if "sdownload" in parsed: - if parsed["sdownload"] == "1": + if parsed['sdownload'] == "1": self.fail( _("Download from %s is possible only using NoPremium.pl website \ - directly") % parsed["hosting"]) + directly") % parsed['hosting']) - pyfile.name = parsed["filename"] - pyfile.size = parsed["filesize"] + pyfile.name = parsed['filename'] + pyfile.size = parsed['filesize'] try: self.link = self.runFileQuery(pyfile.url, 'filedownload') diff --git a/module/plugins/hoster/RapideoPl.py b/module/plugins/hoster/RapideoPl.py index 6304bd38a..479371162 100644 --- a/module/plugins/hoster/RapideoPl.py +++ b/module/plugins/hoster/RapideoPl.py @@ -46,9 +46,9 @@ class RapideoPl(MultiHoster): def runFileQuery(self, url, mode=None): query = self.API_QUERY.copy() - query["username"] = self.usr - query["password"] = self.pwd - query["url"] = url + query['username'] = self.usr + query['password'] = self.pwd + query['url'] = url if mode == "fileinfo": query['check'] = 2 @@ -77,24 +77,24 @@ class RapideoPl(MultiHoster): self.logDebug(parsed) if "errno" in parsed.keys(): - if parsed["errno"] in self.ERROR_CODES: + if parsed['errno'] in self.ERROR_CODES: #: error code in known - self.fail(self.ERROR_CODES[parsed["errno"]] % self.__name__) + self.fail(self.ERROR_CODES[parsed['errno']] % self.__name__) else: #: error code isn't yet added to plugin self.fail( - parsed["errstring"] - or _("Unknown error (code: %s)") % parsed["errno"] + parsed['errstring'] + or _("Unknown error (code: %s)") % parsed['errno'] ) if "sdownload" in parsed: - if parsed["sdownload"] == "1": + if parsed['sdownload'] == "1": self.fail( _("Download from %s is possible only using Rapideo.pl website \ - directly") % parsed["hosting"]) + directly") % parsed['hosting']) - pyfile.name = parsed["filename"] - pyfile.size = parsed["filesize"] + pyfile.name = parsed['filename'] + pyfile.size = parsed['filesize'] try: self.link = self.runFileQuery(pyfile.url, 'filedownload') diff --git a/module/plugins/hoster/SmoozedCom.py b/module/plugins/hoster/SmoozedCom.py index af6c8b68e..ab8e7b714 100644 --- a/module/plugins/hoster/SmoozedCom.py +++ b/module/plugins/hoster/SmoozedCom.py @@ -39,17 +39,17 @@ class SmoozedCom(MultiHoster): data = json_loads(self.load("http://www2.smoozed.com/api/check", get=get_data)) - if data["state"] != "ok": - self.fail(data["message"]) + if data['state'] != "ok": + self.fail(data['message']) - if data["data"].get("state", "ok") != "ok": - if data["data"] == "Offline": + if data['data'].get("state", "ok") != "ok": + if data['data'] == "Offline": self.offline() else: - self.fail(data["data"]["message"]) + self.fail(data['data']['message']) - pyfile.name = data["data"]["name"] - pyfile.size = int(data["data"]["size"]) + pyfile.name = data['data']['name'] + pyfile.size = int(data['data']['size']) #: Start the download header = self.load("http://www2.smoozed.com/api/download", get=get_data, just_header=True) @@ -57,4 +57,4 @@ class SmoozedCom(MultiHoster): if not "location" in header: self.fail(_("Unable to initialize download")) else: - self.link = header["location"][-1] if isinstance(header["location"], list) else header["location"] + self.link = header['location'][-1] if isinstance(header['location'], list) else header['location'] diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py index 7bae8cc19..302554624 100644 --- a/module/plugins/hoster/ZippyshareCom.py +++ b/module/plugins/hoster/ZippyshareCom.py @@ -87,7 +87,7 @@ class ZippyshareCom(SimpleHoster): scripts = ['\n'.join(('try{', script, '} catch(err){}')) for script in scripts] #: get the file's url by evaluating all the scripts - scripts = ['var GVAR = {}'] + list(initScripts) + scripts + ['GVAR["dlbutton_href"]'] + scripts = ['var GVAR = {}'] + list(initScripts) + scripts + ['GVAR['dlbutton_href']'] return self.js.eval('\n'.join(scripts)) diff --git a/module/plugins/internal/SevenZip.py b/module/plugins/internal/SevenZip.py index 7a79c278c..147ac6bd4 100644 --- a/module/plugins/internal/SevenZip.py +++ b/module/plugins/internal/SevenZip.py @@ -139,8 +139,8 @@ class SevenZip(UnRar): args.append("-y") #set a password - if "password" in kwargs and kwargs["password"]: - args.append("-p%s" % kwargs["password"]) + if "password" in kwargs and kwargs['password']: + args.append("-p%s" % kwargs['password']) else: args.append("-p-") |