summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2014-10-17 20:55:00 +0200
committerGravatar Walter Purcaro <vuolter@gmail.com> 2014-10-17 20:55:00 +0200
commit18836967d39d0b6e6f2aeea4e6aece605246a2bf (patch)
tree4c94feb71ea9a1e1c8adb3278eb72117201fc253 /module
parent[XFileSharingPro] Updated to support XFileSharingProFolder (diff)
downloadpyload-18836967d39d0b6e6f2aeea4e6aece605246a2bf.tar.xz
Spare code cosmetics
Diffstat (limited to 'module')
-rw-r--r--module/plugins/Plugin.py12
-rw-r--r--module/plugins/accounts/RapidfileshareNet.py2
-rw-r--r--module/plugins/captcha/captcha.py15
-rw-r--r--module/plugins/crypter/EasybytezComFolder.py2
-rw-r--r--module/plugins/crypter/TusfilesNetFolder.py2
5 files changed, 15 insertions, 18 deletions
diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py
index fa1d2c3b1..d17776485 100644
--- a/module/plugins/Plugin.py
+++ b/module/plugins/Plugin.py
@@ -335,9 +335,9 @@ class Plugin(Base):
img = self.load(url, get=get, post=post, cookies=cookies)
id = ("%.2f" % time())[-6:].replace(".", "")
- temp_file = open(join("tmp", "tmpCaptcha_%s_%s.%s" % (self.__name__, id, imgtype)), "wb")
- temp_file.write(img)
- temp_file.close()
+ tmpCaptcha = open(join("tmp", "tmpCaptcha_%s_%s.%s" % (self.__name__, id, imgtype)), "wb")
+ tmpCaptcha.write(img)
+ tmpCaptcha.close()
has_plugin = self.__name__ in self.core.pluginManager.captchaPlugins
@@ -351,10 +351,10 @@ class Plugin(Base):
if self.pyfile.abort: raise Abort
ocr = Ocr()
- result = ocr.get_captcha(temp_file.name)
+ result = ocr.get_captcha(tmpCaptcha.name)
else:
captchaManager = self.core.captchaManager
- task = captchaManager.newTask(img, imgtype, temp_file.name, result_type)
+ task = captchaManager.newTask(img, imgtype, tmpCaptcha.name, result_type)
self.cTask = task
captchaManager.handleCaptcha(task)
@@ -378,7 +378,7 @@ class Plugin(Base):
if not self.core.debug:
try:
- remove(temp_file.name)
+ remove(tmpCaptcha.name)
except:
pass
diff --git a/module/plugins/accounts/RapidfileshareNet.py b/module/plugins/accounts/RapidfileshareNet.py
index 0b021aea7..99a4af98b 100644
--- a/module/plugins/accounts/RapidfileshareNet.py
+++ b/module/plugins/accounts/RapidfileshareNet.py
@@ -16,4 +16,4 @@ class RapidfileshareNet(XFSPAccount):
HOSTER_URL = "http://www.rapidfileshare.net/"
TRAFFIC_LEFT_PATTERN = r'>Traffic available today:</TD><TD><label for="name">\s*(?P<S>[\d.,]+)\s*(?:(?P<U>[\w^_]+)\s*)?</label></TD></TR>'
-
+
diff --git a/module/plugins/captcha/captcha.py b/module/plugins/captcha/captcha.py
index b3d4bd57e..fb85d8996 100644
--- a/module/plugins/captcha/captcha.py
+++ b/module/plugins/captcha/captcha.py
@@ -51,28 +51,25 @@ class OCR(object):
self.logger.debug("Tesseract ReturnCode %s Output: %s" % (popen.returncode, output))
def run_tesser(self, subset=False, digits=True, lowercase=True, uppercase=True):
- #self.logger.debug("create tmp tif")
+ #tmpTif = tempfile.NamedTemporaryFile(suffix=".tif")
+ tmpTif = open(join("tmp", "tmpTif_%s.tif" % self.__name__), "wb")
+ tmpTif.close()
- #tmp = tempfile.NamedTemporaryFile(suffix=".tif")
- tmp = open(join("tmp", "tmpTif_%s.tif" % self.__name__), "wb")
- tmp.close()
- #self.logger.debug("create tmp txt")
#tmpTxt = tempfile.NamedTemporaryFile(suffix=".txt")
tmpTxt = open(join("tmp", "tmpTxt_%s.txt" % self.__name__), "wb")
tmpTxt.close()
self.logger.debug("save tiff")
- self.image.save(tmp.name, 'TIFF')
+ self.image.save(tmpTif.name, 'TIFF')
if os.name == "nt":
tessparams = [join(pypath, "tesseract", "tesseract.exe")]
else:
tessparams = ["tesseract"]
- tessparams.extend( [abspath(tmp.name), abspath(tmpTxt.name).replace(".txt", "")] )
+ tessparams.extend( [abspath(tmpTif.name), abspath(tmpTxt.name).replace(".txt", "")] )
if subset and (digits or lowercase or uppercase):
- #self.logger.debug("create temp subset config")
#tmpSub = tempfile.NamedTemporaryFile(suffix=".subset")
tmpSub = open(join("tmp", "tmpSub_%s.subset" % self.__name__), "wb")
tmpSub.write("tessedit_char_whitelist ")
@@ -99,7 +96,7 @@ class OCR(object):
self.logger.debug(self.result_captcha)
try:
- os.remove(tmp.name)
+ os.remove(tmpTif.name)
os.remove(tmpTxt.name)
if subset and (digits or lowercase or uppercase):
os.remove(tmpSub.name)
diff --git a/module/plugins/crypter/EasybytezComFolder.py b/module/plugins/crypter/EasybytezComFolder.py
index 0b73a10ae..c80b6cd61 100644
--- a/module/plugins/crypter/EasybytezComFolder.py
+++ b/module/plugins/crypter/EasybytezComFolder.py
@@ -15,7 +15,7 @@ class EasybytezComFolder(SimpleCrypter):
__authors__ = [("stickell", "l.stickell@yahoo.it")]
- URL_REPLACEMENTS = [(__pattern__, r"http://www.easybytez.com/users/\g<ID>?per_page=10000")]
+ URL_REPLACEMENTS = [(__pattern__, r'http://www.easybytez.com/users/\g<ID>?per_page=10000')]
LINK_PATTERN = r'<td><a href="(http://www\.easybytez\.com/\w+)" target="_blank">.+(?:</a>)?</td>'
TITLE_PATTERN = r'<Title>Files of \d+: (.+) folder</Title>'
diff --git a/module/plugins/crypter/TusfilesNetFolder.py b/module/plugins/crypter/TusfilesNetFolder.py
index a6e76adb8..1d804c2a8 100644
--- a/module/plugins/crypter/TusfilesNetFolder.py
+++ b/module/plugins/crypter/TusfilesNetFolder.py
@@ -12,7 +12,7 @@ class TusfilesNetFolder(SimpleCrypter):
__type__ = "crypter"
__version__ = "0.03"
- __pattern__ = r'https?://(?:www\.)?tusfiles\.net/go/(?P<ID>\w+)/?'
+ __pattern__ = r'https?://(?:www\.)?tusfiles\.net/go/(?P<ID>\w+)'
__description__ = """Tusfiles.net folder decrypter plugin"""
__license__ = "GPLv3"