summaryrefslogtreecommitdiffstats
path: root/module/plugins
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-07-23 18:53:06 +0200
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-07-23 18:53:06 +0200
commit4fc28dc09f9632eb4a15a1ef48778427f9dcae33 (patch)
treea58c9700f80598409856bac5fc9523c0bcd7d07f /module/plugins
parent[Extractor] is_usable -> find (diff)
downloadpyload-4fc28dc09f9632eb4a15a1ef48778427f9dcae33.tar.xz
Code cosmetics
Diffstat (limited to 'module/plugins')
-rw-r--r--module/plugins/captcha/CircleCaptcha.py237
-rw-r--r--module/plugins/crypter/GoogledriveComFolder.py2
-rw-r--r--module/plugins/crypter/LinkCryptWs.py2
-rw-r--r--module/plugins/crypter/TNTVillageScambioeticoOrg.py2
-rw-r--r--module/plugins/hooks/ExtractArchive.py2
-rw-r--r--module/plugins/hooks/MegaRapidoNetHook.py10
-rw-r--r--module/plugins/hooks/UnSkipOnFail.py2
-rw-r--r--module/plugins/hoster/PremiumizeMe.py2
-rw-r--r--module/plugins/hoster/SmoozedCom.py2
-rw-r--r--module/plugins/hoster/Xdcc.py10
-rw-r--r--module/plugins/internal/Account.py2
-rw-r--r--module/plugins/internal/Crypter.py2
-rw-r--r--module/plugins/internal/Hoster.py4
-rw-r--r--module/plugins/internal/SimpleCrypter.py2
-rw-r--r--module/plugins/internal/UnRar.py4
15 files changed, 146 insertions, 139 deletions
diff --git a/module/plugins/captcha/CircleCaptcha.py b/module/plugins/captcha/CircleCaptcha.py
index 4c7a82d95..a93defb13 100644
--- a/module/plugins/captcha/CircleCaptcha.py
+++ b/module/plugins/captcha/CircleCaptcha.py
@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-
+#
+#@TODO: Recheck all
from __future__ import division
@@ -67,14 +69,14 @@ class CircleCaptcha(OCR):
jump = False
howmany = 0
curcolor = curpix
- # print (x, y), jump, 2
+ # self.log_debug(x, y, jump, 2)
else:
if howmany == 0:
#: Found pixel
jump = True
howmany = howmany + 1
curcolor = curpix
- # print (x, y), jump, 2
+ # self.log_debug(x, y, jump, 2)
else:
howmany = howmany + 1
if howmany == 1:
@@ -98,14 +100,14 @@ class CircleCaptcha(OCR):
jump = False
howmany = 0
curcolor = curpix
- # print (x, y), jump
+ # self.log_debug(x, y, jump)
else:
if howmany == 0:
#: Found pixel
jump = True
howmany = howmany + 1
curcolor = curpix
- # print (x, y), jump
+ # self.log_debug(x, y, jump)
else:
howmany = howmany + 1
if howmany == 1:
@@ -119,7 +121,7 @@ class CircleCaptcha(OCR):
imageheight = xrange(1, int(im.size[1]))
imagewidth = xrange(curx+1, int(im.size[0]))
jump = True
- newx = (-1,-1)
+ newx = (-1, -1)
blackfound = 0
for x in imagewidth:
curpix = pix[x, cury]
@@ -149,7 +151,7 @@ class CircleCaptcha(OCR):
def find_last_pixel_x(self, im, pix, curx, cury, color = -1, ExitWithBlack = False):
imageheight = xrange(1, int(im.size[1]))
imagewidth = xrange(curx+1, int(im.size[0]))
- newx = (-1,-1)
+ newx = (-1, -1)
blackfound = 0
for x in imagewidth:
curpix = pix[x, cury]
@@ -162,7 +164,7 @@ class CircleCaptcha(OCR):
continue
if curpix >= self.BACKGROUND:
- if newx != (-1,-1):
+ if newx != (-1, -1):
#: Found last pixel and the first white
break
@@ -178,9 +180,9 @@ class CircleCaptcha(OCR):
if DownToUp == False:
imageheight = xrange(int(cury)+1, int(im.size[1])-1)
else:
- imageheight = xrange(int(cury)-1, 1,-1)
- imagewidth = xrange(int(curx),int(im.size[0]))
- newy = (-1,-1)
+ 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]
@@ -193,7 +195,7 @@ class CircleCaptcha(OCR):
continue
if curpix >= self.BACKGROUND:
- if newy != (-1,-1):
+ if newy != (-1, -1):
#: Found last pixel and the first white
break
@@ -242,8 +244,8 @@ class CircleCaptcha(OCR):
-1 -> Not found circle
-2 -> Found black position then leave position
"""
- imageheight = xrange(int(c[1]-c[2]),int(c[1]+c[2]))
- imagewidth = xrange(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
@@ -260,31 +262,31 @@ class CircleCaptcha(OCR):
return -1
#: Check cardinal points (at least 3) (if found i have to leave this position)
- if pix[c[0] + c[2],c[1]] < self.BLACKCOLOR:
+ if pix[c[0] + c[2], c[1]] < self.BLACKCOLOR:
return -2
- if pix[c[0] - c[2],c[1]] < self.BLACKCOLOR:
+ if pix[c[0] - c[2], c[1]] < self.BLACKCOLOR:
return -2
- if pix[c[0],c[1] + c[2]] < self.BLACKCOLOR:
+ if pix[c[0], c[1] + c[2]] < self.BLACKCOLOR:
return -2
- if pix[c[0],c[1] - c[2]] < self.BLACKCOLOR:
+ if pix[c[0], c[1] - c[2]] < self.BLACKCOLOR:
return -2
cardinalpoints = 0
- if self.verify_point(im, pix, c[0] + c[2],c[1],True) == 1:
+ if self.verify_point(im, pix, c[0] + c[2], c[1], True) == 1:
cardinalpoints = cardinalpoints + 1
- if self.verify_point(im, pix, c[0] + c[2],c[1],False) == -1:
+ if self.verify_point(im, pix, c[0] + c[2], c[1], False) == -1:
return -2
- if self.verify_point(im, pix, c[0] - c[2],c[1],True) == 1:
+ if self.verify_point(im, pix, c[0] - c[2], c[1], True) == 1:
cardinalpoints = cardinalpoints + 1
- if self.verify_point(im, pix, c[0] - c[2],c[1],False) == -1:
+ if self.verify_point(im, pix, c[0] - c[2], c[1], False) == -1:
return -2
- if self.verify_point(im, pix, c[0],c[1] + c[2],True) == 1:
+ if self.verify_point(im, pix, c[0], c[1] + c[2], True) == 1:
cardinalpoints = cardinalpoints + 1
- if self.verify_point(im, pix, c[0],c[1] + c[2],False) == -1:
+ if self.verify_point(im, pix, c[0], c[1] + c[2], False) == -1:
return -2
- if self.verify_point(im, pix, c[0],c[1] - c[2],True) == 1:
+ if self.verify_point(im, pix, c[0], c[1] - c[2], True) == 1:
cardinalpoints = cardinalpoints + 1
- if self.verify_point(im, pix, c[0],c[1] - c[2],False) == -1:
+ if self.verify_point(im, pix, c[0], c[1] - c[2], False) == -1:
return -2
if cardinalpoints < 3:
return -1
@@ -323,8 +325,8 @@ class CircleCaptcha(OCR):
-1 -> Not found circle
-2 -> Found black position then leave position
"""
- imageheight = xrange(int(c[1]-c[2]),int(c[1]+c[2]))
- imagewidth = xrange(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
@@ -341,31 +343,31 @@ class CircleCaptcha(OCR):
return -1
#: Check cardinal points (at least 3) (if found i have to leave this position)
- if pix[c[0] + c[2],c[1]] < self.BLACKCOLOR:
+ if pix[c[0] + c[2], c[1]] < self.BLACKCOLOR:
return -2
- if pix[c[0] - c[2],c[1]] < self.BLACKCOLOR:
+ if pix[c[0] - c[2], c[1]] < self.BLACKCOLOR:
return -2
- if pix[c[0],c[1] + c[2]] < self.BLACKCOLOR:
+ if pix[c[0], c[1] + c[2]] < self.BLACKCOLOR:
return -2
- if pix[c[0],c[1] - c[2]] < self.BLACKCOLOR:
+ if pix[c[0], c[1] - c[2]] < self.BLACKCOLOR:
return -2
cardinalpoints = 0
- if self.verify_point(im, pix, c[0] + c[2],c[1],True) == 1:
+ if self.verify_point(im, pix, c[0] + c[2], c[1], True) == 1:
cardinalpoints = cardinalpoints + 1
- if self.verify_point(im, pix, c[0] + c[2],c[1],False) == -1:
+ if self.verify_point(im, pix, c[0] + c[2], c[1], False) == -1:
return -2
- if self.verify_point(im, pix, c[0] - c[2],c[1],True) == 1:
+ if self.verify_point(im, pix, c[0] - c[2], c[1], True) == 1:
cardinalpoints = cardinalpoints + 1
- if self.verify_point(im, pix, c[0] - c[2],c[1],False) == -1:
+ if self.verify_point(im, pix, c[0] - c[2], c[1], False) == -1:
return -2
- if self.verify_point(im, pix, c[0],c[1] + c[2],True) == 1:
+ if self.verify_point(im, pix, c[0], c[1] + c[2], True) == 1:
cardinalpoints = cardinalpoints + 1
- if self.verify_point(im, pix, c[0],c[1] + c[2],False) == -1:
+ if self.verify_point(im, pix, c[0], c[1] + c[2], False) == -1:
return -2
- if self.verify_point(im, pix, c[0],c[1] - c[2],True) == 1:
+ if self.verify_point(im, pix, c[0], c[1] - c[2], True) == 1:
cardinalpoints = cardinalpoints + 1
- if self.verify_point(im, pix, c[0],c[1] - c[2],False) == -1:
+ if self.verify_point(im, pix, c[0], c[1] - c[2], False) == -1:
return -2
if cardinalpoints < 3:
return -1
@@ -420,18 +422,18 @@ class CircleCaptcha(OCR):
for p in missinglist:
#: Left and bottom
- if (self.verify_point(im, pix, p[0]-1, p[1],exactfind) == 1 and \
+ 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 \
+ 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
- elif (self.verify_point(im, pix, p[0]+1, p[1],exactfind) == 1 and \
+ 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
- elif (self.verify_point(im, pix, p[0]+1, p[1],exactfind) == 1 and \
+ 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
@@ -443,7 +445,7 @@ class CircleCaptcha(OCR):
(p[0]-1, p[1]+1) in missinglist or \
(p[0]+1, p[1]-1) in missinglist or \
(p[0]-1, p[1]-1) in missinglist or \
- self.verify_point(im, pix, p[0], p[1],False) == 1:
+ self.verify_point(im, pix, p[0], p[1], False) == 1:
missingconsecutive = missingconsecutive + 1
# else:
# pix[p[0], p[1]] = 0
@@ -461,16 +463,16 @@ class CircleCaptcha(OCR):
maxY = max(missinglist, key=operator.itemgetter(1))[1]
#: Assial Simmetric
- if self._DEBUG == True:
- print "Center: " + str(c)
- print "Missing: " + str(missing)
- print "Howmany: " + str(howmany)
- print "Ratio: " + str(missing / howmany)
- print "Missing consecutives: " + str(missingconsecutive)
- print "Missing X lenght: " + str(minX) + ":" + str(maxX)
- print "Missing Y lenght: " + str(minY) + ":" + str(maxY)
- print "Ratio without consecutives: " + str((missing - missingconsecutive) / howmany)
- print "List missing: " + str(missinglist)
+ if self.pyload.debug:
+ self.log_debug("Center: " + str(c),
+ "Missing: " + str(missing),
+ "Howmany: " + str(howmany),
+ "Ratio: " + str(missing / howmany),
+ "Missing consecutives: " + str(missingconsecutive),
+ "Missing X lenght: " + str(minX) + ":" + str(maxX),
+ "Missing Y lenght: " + str(minY) + ":" + str(maxY),
+ "Ratio without consecutives: " + str((missing - missingconsecutive) / howmany),
+ "List missing: " + str(missinglist))
#: Lenght of missing cannot be over 75% of diameter
@@ -532,7 +534,7 @@ class CircleCaptcha(OCR):
result = 1
if curpix <= self.BLACKCOLOR:
result = -1
- # print str((x, y)) + " = " + str(result)
+ # self.log_debug(str((x, y)) + " = " + str(result))
return result
@@ -546,15 +548,16 @@ class CircleCaptcha(OCR):
mypalette = im.getpalette()
im = im.convert('L')
- if self._DEBUG == True:
+ if self.pyload.debug:
iDebugSaveFile = iDebugSaveFile + 1
- # if iDebugSaveFile < 7: continue
+ # if iDebugSaveFile < 7:
+ # continue
im.save("output" + str(iDebugSaveFile) + ".png", "png")
raw_input('frame: '+ str(im))
pix = im.load()
- stepheight = xrange(1, im.size[1],2)
+ 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
@@ -564,7 +567,7 @@ class CircleCaptcha(OCR):
min_distance = 10
max_diameter = 70
- if self._DEBUG == True:
+ if self.pyload.debug:
imdebug = im.copy()
draw = ImageDraw.Draw(imdebug)
pixcopy = imdebug.load()
@@ -589,15 +592,16 @@ class CircleCaptcha(OCR):
break
if x1 == -1:
break
- if self._DEBUG == True:
- print "x1, y1 -> " + str((x1, y1)) + ": " + str(pix[x1, y1])
+ if self.pyload.debug:
+ self.log_debug("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.pyload.debug:
+ self.log_debug("Found " + str((x1, y1)))
continue
- if self._DEBUG == True: pixcopy[x1, y1] = 45 #(255, 0, 0, 255)
+ if self.pyload.debug:
+ pixcopy[x1, y1] = 45 #(255, 0, 0, 255)
#: found 1 pixel, seeking x2, y2
x2 = x1
y2 = y1
@@ -609,8 +613,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.pyload.debug:
+ self.log_debug("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):
@@ -618,7 +622,8 @@ class CircleCaptcha(OCR):
if abs(x2 - x1) > max_diameter:
break
- if self._DEBUG == True: pixcopy[x2, y2] = 65 #(0, 255, 0, 255)
+ if self.pyload.debug:
+ pixcopy[x2, y2] = 65 #(0, 255, 0, 255)
#: found 2 pixel, seeking x3, y3
#: Verify cord
@@ -627,7 +632,7 @@ class CircleCaptcha(OCR):
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)
+ # self.log_debug(x3, y3, retval[0], invert)
y3 = retval[0]
if y3 == -2:
findnewcircle = True
@@ -635,8 +640,8 @@ class CircleCaptcha(OCR):
if y3 == -1:
break
- if self._DEBUG == True:
- print "x3, y3 -> " + str((x3, y3)) + ": " + str(pix[x3, y3])
+ if self.pyload.debug:
+ self.log_debug("x3, y3 -> " + str((x3, y3)) + ": " + str(pix[x3, y3]))
#: Verify cord
if abs(y3 - y2) < min_distance:
continue
@@ -645,38 +650,40 @@ class CircleCaptcha(OCR):
if abs(y3 - y2) > max_diameter:
break
- if self._DEBUG == True: pixcopy[x3, y3] = 85
+ if self.pyload.debug:
+ pixcopy[x3, y3] = 85
#: found 3 pixel. try circle
c = self.find_circle(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
- if self._DEBUG == True: pixcopy[c[0],c[1]] = 0
+ if self.pyload.debug:
+ pixcopy[c[0], c[1]] = 0
#: (x-r, y-r, x+r, y+r)
verified = self.verify_circle(im, pix, c)
if verified == -1:
verified = -1
elif verified == 0:
- found.add(((c[0],c[1],c[2]),verified))
+ found.add(((c[0], c[1], c[2]), verified))
findnewcircle = True
elif verified == 1:
- found.add(((c[0],c[1],c[2]),verified))
+ found.add(((c[0], c[1], c[2]), verified))
findnewcircle = True
- if self._DEBUG == True:
+ if self.pyload.debug:
_pause = ""
# if verified == -1:
- # draw.ellipse((c[0]-c[2],c[1]-c[2],c[0]+c[2],c[1]+c[2]),outline=0)
+ # 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)
+ draw.ellipse((c[0]-c[2], c[1]-c[2], c[0]+c[2], c[1]+c[2]), outline=120)
_pause = "OPENED"
if verified == 1:
- draw.ellipse((c[0]-c[2],c[1]-c[2],c[0]+c[2],c[1]+c[2]),outline=65)
+ draw.ellipse((c[0]-c[2], c[1]-c[2], c[0]+c[2], c[1]+c[2]), outline=65)
_pause = "CLOSED"
imdebug.save("debug.png", "png")
@@ -693,8 +700,8 @@ class CircleCaptcha(OCR):
if findnewcircle == True:
break
- if self._DEBUG == True:
- print 'Howmany opened circle? ' + str(len(found)) + ' ' + str(found)
+ if self.pyload.debug:
+ self.log_debug('Howmany opened circle? ' + str(len(found)) + ' ' + str(found))
#: Clean results
for c in found:
@@ -702,60 +709,60 @@ 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]+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], 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 \
):
#: 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]+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], 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 \
):
#: 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]+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], 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 \
):
#: Delete nearly circle
verify = -1
# if verify == 0:
- # if self._DEBUG == True:
- # pix[c[0][0],c[0][1]] = 90 #(255, 255, 0)
+ # if self.pyload.debug:
+ # pix[c[0][0], c[0][1]] = 90 #(255, 255, 0)
# im.save("output.png", "png")
- # return c[0][0],c[0][1]
+ # 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)
+ # if self.pyload.debug:
+ # 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)
+ # if self.pyload.debug:
+ # pix[c[0][0], c[0][1]] = 180 #(0, 0, 255)
# im.save("output.png", "png")
- if self._DEBUG == True:
+ if self.pyload.debug:
im.save("output.png", "png")
@@ -764,13 +771,13 @@ class CircleCaptcha(OCR):
file = cStringIO.StringIO(urllib.urlopen(url).read())
img = Image.open(file)
coords = self.decrypt(img)
- print "Coords: " + str(coords)
+ self.log_info(_("Coords: %s") % coords)
#: 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)
+ self.log_info(_("Coords: %s") % coords)
##DEBUG
@@ -780,4 +787,4 @@ class CircleCaptcha(OCR):
# coords = x.decrypt_from_file("decripter/captx.html2.gif")
# coords = x.decrypt_from_web("http://ncrypt.in/classes/captcha/circlecaptcha.php")
# b = datetime.datetime.now()
-# print 'Elapsed time: ' + str((b-a).seconds) + ' seconds'
+# self.log_debug("Elapsed time: %s seconds" % (b-a).seconds)
diff --git a/module/plugins/crypter/GoogledriveComFolder.py b/module/plugins/crypter/GoogledriveComFolder.py
index 13cb83071..47ed891f8 100644
--- a/module/plugins/crypter/GoogledriveComFolder.py
+++ b/module/plugins/crypter/GoogledriveComFolder.py
@@ -10,7 +10,7 @@ class GoogledriveComFolder(SimpleCrypter):
__status__ = "stable"
__pattern__ = r'https?://(?:www\.)?drive\.google\.com/folderview\?.*id=\w+'
- __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), #: Overrides core.config['general']['folder_per_package']
+ __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), #: Overrides pyload.config['general']['folder_per_package']
("subfolder_per_pack", "bool", "Create a subfolder for each package", True)]
__description__ = """Drive.google.com folder decrypter plugin"""
diff --git a/module/plugins/crypter/LinkCryptWs.py b/module/plugins/crypter/LinkCryptWs.py
index 5195c47c3..baa440c51 100644
--- a/module/plugins/crypter/LinkCryptWs.py
+++ b/module/plugins/crypter/LinkCryptWs.py
@@ -150,7 +150,7 @@ class LinkCryptWs(Crypter):
def getunrarpw(self):
sitein = self.html
indexi = sitein.find("|source|") + 8
- indexe = sitein.find("|",indexi)
+ indexe = sitein.find("|", indexi)
unrarpw = sitein[indexi:indexe]
diff --git a/module/plugins/crypter/TNTVillageScambioeticoOrg.py b/module/plugins/crypter/TNTVillageScambioeticoOrg.py
index 4de4e090a..f680e53e8 100644
--- a/module/plugins/crypter/TNTVillageScambioeticoOrg.py
+++ b/module/plugins/crypter/TNTVillageScambioeticoOrg.py
@@ -10,7 +10,7 @@ class TNTVillageScambioeticoOrg(SimpleCrypter):
__status__ = "stable"
__pattern__ = r'http://(?:www\.)?forum\.tntvillage\.scambioetico\.org/index\.php\?.*showtopic=\d+'
- __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), #: Overrides core.config['general']['folder_per_package']
+ __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), #: Overrides pyload.config['general']['folder_per_package']
("subfolder_per_pack", "bool", "Create a subfolder for each package", True)]
__description__ = """TNTVillage.scambioetico.org decrypter plugin"""
diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py
index 6f353f538..0f757f258 100644
--- a/module/plugins/hooks/ExtractArchive.py
+++ b/module/plugins/hooks/ExtractArchive.py
@@ -298,7 +298,7 @@ class ExtractArchive(Addon):
matched = False
success = True
- files_ids = dict((pylink['name'],((fs_join(download_folder, pypack.folder, pylink['name'])), pylink['id'], out)) for pylink \
+ 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
#: Check as long there are unseen files
diff --git a/module/plugins/hooks/MegaRapidoNetHook.py b/module/plugins/hooks/MegaRapidoNetHook.py
index 56b582a78..1dae5056f 100644
--- a/module/plugins/hooks/MegaRapidoNetHook.py
+++ b/module/plugins/hooks/MegaRapidoNetHook.py
@@ -22,14 +22,14 @@ class MegaRapidoNetHook(MultiHook):
def get_hosters(self):
- hosters = {'1fichier' : [],#leave it there are so many possible addresses?
+ hosters = {'1fichier' : [], # leave it there are so many possible addresses?
'1st-files' : ['1st-files.com'],
'2shared' : ['2shared.com'],
'4shared' : ['4shared.com', '4shared-china.com'],
'asfile' : ['http://asfile.com/'],
'bitshare' : ['bitshare.com'],
'brupload' : ['brupload.net'],
- 'crocko' : ['crocko.com','easy-share.com'],
+ 'crocko' : ['crocko.com', 'easy-share.com'],
'dailymotion' : ['dailymotion.com'],
'depfile' : ['depfile.com'],
'depositfiles': ['depositfiles.com', 'dfiles.eu'],
@@ -39,12 +39,12 @@ class MegaRapidoNetHook(MultiHook):
'extmatrix' : ['extmatrix.com'],
'facebook' : [],
'file4go' : ['file4go.com'],
- 'filecloud' : ['filecloud.io','ifile.it','mihd.net'],
+ 'filecloud' : ['filecloud.io', 'ifile.it', 'mihd.net'],
'filefactory' : ['filefactory.com'],
'fileom' : ['fileom.com'],
'fileparadox' : ['fileparadox.in'],
'filepost' : ['filepost.com', 'fp.io'],
- 'filerio' : ['filerio.in','filerio.com','filekeen.com'],
+ 'filerio' : ['filerio.in', 'filerio.com', 'filekeen.com'],
'filesflash' : ['filesflash.com'],
'firedrive' : ['firedrive.com', 'putlocker.com'],
'flashx' : [],
@@ -52,7 +52,7 @@ class MegaRapidoNetHook(MultiHook):
'gigasize' : ['gigasize.com'],
'hipfile' : ['hipfile.com'],
'junocloud' : ['junocloud.me'],
- 'letitbit' : ['letitbit.net','shareflare.net'],
+ 'letitbit' : ['letitbit.net', 'shareflare.net'],
'mediafire' : ['mediafire.com'],
'mega' : ['mega.co.nz'],
'megashares' : ['megashares.com'],
diff --git a/module/plugins/hooks/UnSkipOnFail.py b/module/plugins/hooks/UnSkipOnFail.py
index e6064eb7b..74d778d59 100644
--- a/module/plugins/hooks/UnSkipOnFail.py
+++ b/module/plugins/hooks/UnSkipOnFail.py
@@ -35,7 +35,7 @@ class UnSkipOnFail(Addon):
#: (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.
+ #: The pyload.files-manager to save its data.
pylink = self._pyfile(link)
pylink.setCustomStatus(_("unskipped"), "queued")
diff --git a/module/plugins/hoster/PremiumizeMe.py b/module/plugins/hoster/PremiumizeMe.py
index e4922a484..7cf7cf7a7 100644
--- a/module/plugins/hoster/PremiumizeMe.py
+++ b/module/plugins/hoster/PremiumizeMe.py
@@ -10,7 +10,7 @@ class PremiumizeMe(MultiHoster):
__version__ = "0.19"
__status__ = "stable"
- __pattern__ = r'^unmatchable$' #: Since we want to allow the user to specify the list of hoster to use we let MultiHoster.coreReady
+ __pattern__ = r'^unmatchable$' #: Since we want to allow the user to specify the list of hoster to use we let MultiHoster.activate
__config__ = [("use_premium" , "bool", "Use premium account if available" , True),
("revertfailed", "bool", "Revert to standard download if fails", True)]
diff --git a/module/plugins/hoster/SmoozedCom.py b/module/plugins/hoster/SmoozedCom.py
index 98da83350..55e594582 100644
--- a/module/plugins/hoster/SmoozedCom.py
+++ b/module/plugins/hoster/SmoozedCom.py
@@ -10,7 +10,7 @@ class SmoozedCom(MultiHoster):
__version__ = "0.08"
__status__ = "stable"
- __pattern__ = r'^unmatchable$' #: Since we want to allow the user to specify the list of hoster to use we let MultiHoster.coreReady
+ __pattern__ = r'^unmatchable$' #: Since we want to allow the user to specify the list of hoster to use we let MultiHoster.activate
__config__ = [("use_premium" , "bool", "Use premium account if available" , True),
("revertfailed", "bool", "Revert to standard download if fails", True)]
diff --git a/module/plugins/hoster/Xdcc.py b/module/plugins/hoster/Xdcc.py
index de6571b7a..99829d405 100644
--- a/module/plugins/hoster/Xdcc.py
+++ b/module/plugins/hoster/Xdcc.py
@@ -9,6 +9,7 @@ import time
from select import select
from module.plugins.internal.Hoster import Hoster
+# from module.utils import decode
from module.utils import save_join as fs_join
@@ -28,7 +29,6 @@ class Xdcc(Hoster):
def setup(self):
- self.debug = 0 #: 0,1,2
self.timeout = 30
self.multi_dl = False
@@ -128,8 +128,8 @@ class Xdcc(Hoster):
readbuffer = temp.pop()
for line in temp:
- if self.debug is 2:
- print "*> " + unicode(line, errors='ignore')
+ # if self.pyload.debug:
+ # self.log_debug("*> " + decode(line))
line = line.rstrip()
first = line.split()
@@ -165,8 +165,8 @@ class Xdcc(Hoster):
and msg['action'] in ("PRIVMSG", "NOTICE")):
continue
- if self.debug is 1:
- print "%s: %s" % (msg['origin'], msg['text'])
+ if self.pyload.debug:
+ self.log_debug(msg['origin'], msg['text'])
if "You already requested that pack" in msg['text']:
retry = time.time() + 300
diff --git a/module/plugins/internal/Account.py b/module/plugins/internal/Account.py
index 27525e1d2..96f1cb533 100644
--- a/module/plugins/internal/Account.py
+++ b/module/plugins/internal/Account.py
@@ -206,7 +206,7 @@ class Account(Plugin):
def load_account_info(self, name, req=None):
"""
- This should be overwritten in account plugin,\
+ This should be overwritten in account plugin
and retrieving account information for user
:param name:
diff --git a/module/plugins/internal/Crypter.py b/module/plugins/internal/Crypter.py
index 034224b4e..627c198e1 100644
--- a/module/plugins/internal/Crypter.py
+++ b/module/plugins/internal/Crypter.py
@@ -13,7 +13,7 @@ class Crypter(Hoster):
__status__ = "stable"
__pattern__ = r'^unmatchable$'
- __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), #: Overrides core.config.get("general", "folder_per_package")
+ __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), #: Overrides pyload.config.get("general", "folder_per_package")
("subfolder_per_package", "bool", "Create a subfolder for each package", True)]
__description__ = """Base decrypter plugin"""
diff --git a/module/plugins/internal/Hoster.py b/module/plugins/internal/Hoster.py
index af3e80acf..ffd7c4ecc 100644
--- a/module/plugins/internal/Hoster.py
+++ b/module/plugins/internal/Hoster.py
@@ -83,7 +83,7 @@ class Hoster(Plugin):
self.ocr = None
#: Account handler instance, see :py:class:`Account`
- self.account = pyfile.m.core.accountManager.getAccountPlugin(self.__name__)
+ self.account = self.pyload.accountManager.getAccountPlugin(self.__name__)
#: Premium status
self.premium = False
@@ -107,7 +107,7 @@ class Hoster(Plugin):
#: Premium status
self.premium = self.account.is_premium(self.user)
else:
- self.req = pyfile.m.core.requestFactory.getRequest(self.__name__)
+ self.req = self.pyload.requestFactory.getRequest(self.__name__)
#: Associated pyfile instance, see `PyFile`
self.pyfile = pyfile
diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py
index 0e54c30a4..efda7dc1a 100644
--- a/module/plugins/internal/SimpleCrypter.py
+++ b/module/plugins/internal/SimpleCrypter.py
@@ -14,7 +14,7 @@ class SimpleCrypter(Crypter, SimpleHoster):
__status__ = "stable"
__pattern__ = r'^unmatchable$'
- __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), #: Overrides core.config['general']['folder_per_package']
+ __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), #: Overrides pyload.config['general']['folder_per_package']
("subfolder_per_pack", "bool", "Create a subfolder for each package", True)]
__description__ = """Simple decrypter plugin"""
diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py
index 03b19bcf9..1a2e64b94 100644
--- a/module/plugins/internal/UnRar.py
+++ b/module/plugins/internal/UnRar.py
@@ -37,7 +37,7 @@ class UnRar(Extractor):
EXTENSIONS = [".rar"]
- re_multipart = re.compile(r'\.(part|r)(\d+)(?:\.rar)?(\.rev|\.bad)?',re.I)
+ re_multipart = re.compile(r'\.(part|r)(\d+)(?:\.rar)?(\.rev|\.bad)?', re.I)
re_filefixed = re.compile(r'Building (.+)')
re_filelist = re.compile(r'^(.)(\s*[\w\.\-]+)\s+(\d+\s+)+(?:\d+\%\s+)?[\d\-]{8}\s+[\d\:]{5}', re.M|re.I)
@@ -180,7 +180,7 @@ class UnRar(Extractor):
#: eventually Multipart Files
files.extend(fs_join(dir, os.path.basename(file)) for file in filter(self.is_multipart, os.listdir(dir))
- if re.sub(self.re_multipart,".rar",name) == re.sub(self.re_multipart,".rar",file))
+ if re.sub(self.re_multipart, ".rar", name) == re.sub(self.re_multipart, ".rar", file))
return files