summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2010-10-10 20:16:14 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2010-10-10 20:16:14 +0200
commitc880a3b8e048b4f9fea5413f09d3745d5b37609f (patch)
treec19fe4efd71e2e8bd286bbaf551cb0ffe7172f6c /module
parentworkaround (diff)
downloadpyload-c880a3b8e048b4f9fea5413f09d3745d5b37609f.tar.xz
several fixes
Diffstat (limited to 'module')
-rw-r--r--module/FileDatabase.py4
-rw-r--r--module/plugins/Plugin.py5
-rw-r--r--module/plugins/hoster/MegauploadCom.py7
-rw-r--r--module/plugins/hoster/RapidshareCom.py41
-rw-r--r--module/web/templates/500.html10
5 files changed, 33 insertions, 34 deletions
diff --git a/module/FileDatabase.py b/module/FileDatabase.py
index 5f1a903a4..80613db30 100644
--- a/module/FileDatabase.py
+++ b/module/FileDatabase.py
@@ -895,9 +895,9 @@ class FileDatabaseBackend(Thread):
@queue
def getUnfinished(self, pid):
- """return list of ids with pyfiles in package not finished or processed"""
+ """return list of max length 3 ids with pyfiles in package not finished or processed"""
- self.c.execute("SELECT id FROM links WHERE package=? AND status NOT IN (0, 13)", (str(pid),))
+ self.c.execute("SELECT id FROM links WHERE package=? AND status NOT IN (0, 13) LIMIT 3", (str(pid),))
return [r[0] for r in self.c]
diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py
index bfe10845d..00cb2401f 100644
--- a/module/plugins/Plugin.py
+++ b/module/plugins/Plugin.py
@@ -220,7 +220,8 @@ class Plugin(object):
content = self.load(url, get=get, post=post, cookies=cookies)
- temp = open(join("tmp","tmpCaptcha_%s" % self.__name__ ), "wb")
+ id = ("%.2f" % time())[-6:]
+ temp = open(join("tmp","tmpCaptcha_%s_%s" % (id, self.__name__)), "wb")
temp.write(content)
temp.close()
@@ -279,6 +280,8 @@ class Plugin(object):
self.pyfile.setStatus("downloading")
+ self.pyfile.size = 0
+
download_folder = self.config['general']['download_folder'].decode("utf8")
location = join(download_folder.encode(sys.getfilesystemencoding(), "replace"), self.pyfile.package().folder.replace(":", "").encode(sys.getfilesystemencoding(), "replace")) # remove : for win compability
diff --git a/module/plugins/hoster/MegauploadCom.py b/module/plugins/hoster/MegauploadCom.py
index 0380f5fe9..17b07b584 100644
--- a/module/plugins/hoster/MegauploadCom.py
+++ b/module/plugins/hoster/MegauploadCom.py
@@ -79,7 +79,10 @@ class MegauploadCom(Hoster):
check = self.checkDownload({"limit": "Download limit exceeded"})
if check == "limit":
wait = self.load("http://www.megaupload.com/?c=premium&l=1")
- wait = re.search(r"Please wait (\d+) minutes", wait).group(1)
+ try:
+ wait = re.search(r"Please wait (\d+) minutes", wait).group(1)
+ except:
+ wait = 1
self.log.info(_("Megaupload: waiting %d minues") % int(wait))
self.setWait(int(wait)*60, True)
self.wait()
@@ -122,8 +125,6 @@ class MegauploadCom(Hoster):
if re.search(r"Waiting time before each download begins", self.html[1]) is not None:
break
- print self.html[0]
-
def download_api(self):
url = "http://megaupload.com/mgr_linkcheck.php"
diff --git a/module/plugins/hoster/RapidshareCom.py b/module/plugins/hoster/RapidshareCom.py
index 0e3d2e74d..f96e5cd85 100644
--- a/module/plugins/hoster/RapidshareCom.py
+++ b/module/plugins/hoster/RapidshareCom.py
@@ -119,34 +119,19 @@ class RapidshareCom(Hoster):
tmp = "#!download|%(server)s|%(id)s|%(name)s|%(size)s"
download = "http://%(host)s/cgi-bin/rsapi.cgi?sub=download_v1&editparentlocation=1&bin=1&fileid=%(id)s&filename=%(name)s&dlauth=%(auth)s" % self.dl_dict
- dl = self.download(download, ref=False)
-
- self.postCheck(dl)
-
- def postCheck(self, dl):
-
- size = stat(dl)
- size = size.st_size
-
- if (size < int(self.api_data["size"]) and size < 10000):
- f = open(dl, "rb")
- content = f.read()
- f.close()
- self.no_download = True
- if "You need RapidPro to download more files from your IP address" in content:
- remove(dl)
- self.setWait(60)
- self.log.info(_("Already downloading from this ip address, waiting 60 seconds"))
- self.wait()
- self.handleFree()
- elif "Download auth invalid" in content:
- remove(dl)
- self.log.info(_("Invalid Auth Code, download will be restarted"))
- self.offset += 5
- self.handleFree()
-
-
+ self.download(download, ref=False)
+ check = self.checkDownload({"ip" : "You need RapidPro to download more files from your IP address",
+ "auth" : "Download auth invalid"})
+ if check == "ip":
+ self.setWait(60)
+ self.log.info(_("Already downloading from this ip address, waiting 60 seconds"))
+ self.wait()
+ self.handleFree()
+ elif check == "auth":
+ self.log.info(_("Invalid Auth Code, download will be restarted"))
+ self.offset += 5
+ self.handleFree()
def handlePremium(self):
info = self.account.getAccountInfo(self.user, True)
@@ -189,7 +174,7 @@ class RapidshareCom(Hoster):
self.api_data["mirror"] = "http://rs%(serverid)s%(shorthost)s.rapidshare.com/files/%(fileid)s/%(filename)s" % self.api_data
def freeWait(self):
- """downloads html with the important informations
+ """downloads html with the important information
"""
self.html = self.load("http://rapidshare.com/files/%s/%s" % (self.id, self.name),ref=False)
diff --git a/module/web/templates/500.html b/module/web/templates/500.html
new file mode 100644
index 000000000..a751c4893
--- /dev/null
+++ b/module/web/templates/500.html
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+ <title></title>
+</head>
+<body>
+<h1>Server Error occured.</h1>
+</body>
+</html> \ No newline at end of file