summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorGravatar mkaay <mkaay@mkaay.de> 2010-05-17 00:01:05 +0200
committerGravatar mkaay <mkaay@mkaay.de> 2010-05-17 00:01:05 +0200
commit32ba2f79389ccf4f7d40197837c02d28bb13261d (patch)
tree893de3556630eaa8242fa0fe3550039cab210b09 /module
parentnew config option (outgoing intreface) (diff)
downloadpyload-32ba2f79389ccf4f7d40197837c02d28bb13261d.tar.xz
new plugin interface test, ShareonlineBiz + SerienjunkiesOrg + MegauploadedCom fix, other stuff
Diffstat (limited to 'module')
-rw-r--r--module/DownloadThread.py25
-rw-r--r--module/ThreadManager.py27
-rw-r--r--module/plugins/Container.py12
-rw-r--r--module/plugins/captcha/captcha.py4
-rw-r--r--module/plugins/container/DLC_25.pycbin6051 -> 7765 bytes
-rw-r--r--module/plugins/container/DLC_26.pycbin6051 -> 7757 bytes
-rw-r--r--module/plugins/crypter/SerienjunkiesOrg.py17
-rw-r--r--module/plugins/hoster/MegauploadCom.py2
-rw-r--r--module/plugins/hoster/ShareonlineBiz.py26
9 files changed, 90 insertions, 23 deletions
diff --git a/module/DownloadThread.py b/module/DownloadThread.py
index 95e948ec9..95ed88da0 100644
--- a/module/DownloadThread.py
+++ b/module/DownloadThread.py
@@ -117,20 +117,38 @@ class DownloadThread(Thread):
self.parent.parent.pullManager.addEvent(UpdateEvent("file", self.loadedPyFile.id, "queue"))
sleep(0.8)
self.parent.removeThread(self)
-
+
+ def handleNewInterface(self, pyfile):
+ status = pyfile.status
+ plugin = pyfile.plugin
+ status.type = "starting"
+ self.parent.parent.pullManager.addEvent(UpdateEvent("file", pyfile.id, "queue"))
+
+ if plugin.__type__ == "container" or plugin.__type__ == "crypter":
+ status.type = "decrypting"
+ self.parent.parent.pullManager.addEvent(UpdateEvent("file", pyfile.id, "queue"))
+
+ if plugin.__type__ == "container":
+ plugin.decrypt(pyfile.url)
+
+ status.type = "finished"
+
def download(self, pyfile):
+ if hasattr(pyfile.plugin, "__interface__") and pyfile.plugin.__interface__ >= 2:
+ self.handleNewInterface(pyfile)
+ return
status = pyfile.status
status.type = "starting"
self.parent.parent.pullManager.addEvent(UpdateEvent("file", pyfile.id, "queue"))
pyfile.init_download()
-
+
if not pyfile.plugin.prepare(self):
raise Exception, _("File not found")
pyfile.plugin.req.set_timeout(self.parent.parent.config['general']['max_download_time'])
- if pyfile.plugin.__type__ == "container":
+ if pyfile.plugin.__type__ == "container" or pyfile.plugin.__type__ == "crypter":
status.type = "decrypting"
else:
status.type = "downloading"
@@ -167,6 +185,7 @@ class DownloadThread(Thread):
def wait(self, pyfile):
pyfile.status.type = "waiting"
+ self.parent.parent.pullManager.addEvent(UpdateEvent("file", pyfile.id, "queue"))
while (time() < pyfile.status.waituntil):
if self.parent.initReconnect() or self.parent.reconnecting:
pyfile.status.type = "reconnected"
diff --git a/module/ThreadManager.py b/module/ThreadManager.py
index 31a2f004a..4befebd28 100644
--- a/module/ThreadManager.py
+++ b/module/ThreadManager.py
@@ -103,7 +103,28 @@ class ThreadManager(Thread):
if pyfile.plugin.__type__ == "container":
return True
return False
-
+
+ def handleNewInterface(self, pyfile):
+ plugin = pyfile.plugin
+ if plugin.__type__ == "container":
+ if plugin.createNewPackage():
+ packages = plugin.getPackages()
+ if len(packages) == 1:
+ self.parent.logger.info(_("1 new package from %s") % (pyfile.status.filename,))
+ else:
+ self.parent.logger.info(_("%i new packages from %s") % (len(packages), pyfile.status.filename))
+ for name, links in packages:
+ pid = self.list.packager.addNewPackage(name)
+ for link in links:
+ newFile = self.list.collector.addLink(link)
+ self.list.packager.addFileToPackage(pid, self.list.collector.popFile(newFile))
+ if len(links) == 1:
+ self.parent.logger.info(_("1 link in %s") % (name,))
+ else:
+ self.parent.logger.info(_("%i links in %s") % (len(links), name))
+ else:
+ pass
+
def jobFinished(self, pyfile):
"""manage completing download"""
self.lock.acquire()
@@ -122,7 +143,9 @@ class ThreadManager(Thread):
self.py_downloading.remove(pyfile)
if pyfile.status.type == "finished":
- if pyfile.plugin.__type__ == "container":
+ if hasattr(pyfile.plugin, "__interface__") and pyfile.plugin.__interface__ >= 2:
+ self.handleNewInterface(pyfile)
+ elif pyfile.plugin.__type__ == "container":
newLinks = 0
if pyfile.plugin.links:
if isinstance(pyfile.plugin.links, dict):
diff --git a/module/plugins/Container.py b/module/plugins/Container.py
index 2a7196f14..794c52508 100644
--- a/module/plugins/Container.py
+++ b/module/plugins/Container.py
@@ -27,3 +27,15 @@ class Container(Plugin):
__description__ = """Base container plugin"""
__author_name__ = ("mkaay")
__author_mail__ = ("mkaay@mkaay.de")
+
+ def decrypt(self):
+ pass
+
+ def createNewPackage(self):
+ return False
+
+ def getPackages(self):
+ return []
+
+ def getLinks(self):
+ return []
diff --git a/module/plugins/captcha/captcha.py b/module/plugins/captcha/captcha.py
index eec63b54f..db229c747 100644
--- a/module/plugins/captcha/captcha.py
+++ b/module/plugins/captcha/captcha.py
@@ -22,6 +22,7 @@ import logging
import subprocess
import tempfile
import threading
+from os import remove
import Image
@@ -105,7 +106,8 @@ class OCR(object):
tmpSub.write("\n")
tessparams.append("nobatch")
tessparams.append(tmpSub.name)
-
+ tmpSub.flush()
+
self.logger.debug("run tesseract")
self.run(tessparams)
self.logger.debug("read txt")
diff --git a/module/plugins/container/DLC_25.pyc b/module/plugins/container/DLC_25.pyc
index 16833d37a..a2f396dc6 100644
--- a/module/plugins/container/DLC_25.pyc
+++ b/module/plugins/container/DLC_25.pyc
Binary files differ
diff --git a/module/plugins/container/DLC_26.pyc b/module/plugins/container/DLC_26.pyc
index 74947a504..feda85a9a 100644
--- a/module/plugins/container/DLC_26.pyc
+++ b/module/plugins/container/DLC_26.pyc
Binary files differ
diff --git a/module/plugins/crypter/SerienjunkiesOrg.py b/module/plugins/crypter/SerienjunkiesOrg.py
index af95a9c78..6733be2bb 100644
--- a/module/plugins/crypter/SerienjunkiesOrg.py
+++ b/module/plugins/crypter/SerienjunkiesOrg.py
@@ -8,17 +8,16 @@ from module.unescape import unescape
from module.DownloadThread import CaptchaError
class SerienjunkiesOrg(Plugin):
+ __name__ = "SerienjunkiesOrg"
+ __type__ = "container"
+ __pattern__ = r"http://.*?serienjunkies.org/.*?"
+ __version__ = "0.2"
+ __description__ = """serienjunkies.org Container Plugin"""
+ __author_name__ = ("mkaay")
+ __author_mail__ = ("mkaay@mkaay.de")
+
def __init__(self, parent):
Plugin.__init__(self, parent)
- props = {}
- props['name'] = "SerienjunkiesOrg"
- props['type'] = "container"
- props['pattern'] = r"http://.*?serienjunkies.org/.*?"
- props['version'] = "0.2"
- props['description'] = """serienjunkies.org Container Plugin"""
- props['author_name'] = ("mkaay")
- props['author_mail'] = ("mkaay@mkaay.de")
- self.props = props
self.parent = parent
self.html = None
self.multi_dl = False
diff --git a/module/plugins/hoster/MegauploadCom.py b/module/plugins/hoster/MegauploadCom.py
index 10c3ec370..a3c64c124 100644
--- a/module/plugins/hoster/MegauploadCom.py
+++ b/module/plugins/hoster/MegauploadCom.py
@@ -11,7 +11,7 @@ from module.plugins.Hoster import Hoster
class MegauploadCom(Hoster):
__name__ = "MegauploadCom"
__type__ = "hoster"
- __pattern__ = r"http://(?:www.)megaupload.com/"
+ __pattern__ = r"http://[\w\.]*?(megaupload)\.com/.*?(\?|&)d=[0-9A-Za-z]+"
__version__ = "0.1"
__description__ = """Megaupload.com Download Hoster"""
__author_name__ = ("spoob")
diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py
index 9cc0f8263..13d240bb4 100644
--- a/module/plugins/hoster/ShareonlineBiz.py
+++ b/module/plugins/hoster/ShareonlineBiz.py
@@ -39,7 +39,12 @@ class ShareonlineBiz(Hoster):
self.download_api_data()
if self.api_data["status"]:
- self.download_html()
+ for i in range(5):
+ if self.download_html():
+ break
+ else:
+ pyfile.status.waituntil = self.time_plus_wait
+ thread.wait(self.pyfile)
pyfile.status.filename = self.api_data["filename"]
pyfile.status.waituntil = self.time_plus_wait
pyfile.status.url = self.get_file_url()
@@ -84,18 +89,25 @@ class ShareonlineBiz(Hoster):
for i in range(10):
- captcha_image = tempfile.NamedTemporaryFile(suffix=".jpg").name
- self.download("http://www.share-online.biz/captcha.php?rand="+ "0." + str(random.randint(10**15,10**16)), captcha_image, cookies=True)
- captcha = self.ocr.get_captcha(captcha_image)
- os.remove(captcha_image)
- self.logger.debug("Captcha %s: %s" % (i, captcha))
+ captcha_image = tempfile.NamedTemporaryFile(suffix=".jpg", delete=False)
+ imgStr = self.req.load("http://www.share-online.biz/captcha.php?rand="+ "0." + str(random.randint(10**15,10**16)), cookies=True)
+ captcha_image.write(imgStr)
+ captcha_image.close()
+ captcha = self.ocr.get_captcha(captcha_image.name)
+ os.remove(captcha_image.name)
+ self.logger.debug("%s Captcha %s: %s" % (self.__name__, i, captcha))
sleep(3)
self.html[1] = self.load(url, post={"captchacode": captcha}, cookies=True)
- if re.search(r"Der Download ist Ihnen zu langsam", self.html[1]) != None:
+ if re.search(r"no slots available", self.html[1]):
+ self.time_plus_wait = time() + 60
+ return False
+ if re.search(r"Der Download ist Ihnen zu langsam", self.html[1]):
self.time_plus_wait = time() + 15
return True
raise Exception("Captcha not decrypted")
+ else:
+ return True
def get_file_url(self):
""" returns the absolute downloadable filepath