summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2010-10-09 22:12:24 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2010-10-09 22:12:24 +0200
commitdf53830ead89b728d8833c2eaa64d067e366cf4f (patch)
treec4af0c2b14f58eae6a2ba5d54e2fc89d7831f5b4
parentremoved debug prints (diff)
downloadpyload-df53830ead89b728d8833c2eaa64d067e366cf4f.tar.xz
netload fix
-rw-r--r--module/FileDatabase.py12
-rw-r--r--module/ThreadManager.py2
-rw-r--r--module/plugins/hoster/NetloadIn.py7
3 files changed, 14 insertions, 7 deletions
diff --git a/module/FileDatabase.py b/module/FileDatabase.py
index 57339a128..5f1a903a4 100644
--- a/module/FileDatabase.py
+++ b/module/FileDatabase.py
@@ -107,9 +107,11 @@ class FileHandler:
def lock(func):
def new(*args):
+ #print "Handler: %s args: %s" % (func,args[1:])
args[0].lock.acquire()
res = func(*args)
args[0].lock.release()
+ #print "Handler: %s return: %s" % (func, res)
return res
return new
@@ -169,6 +171,7 @@ class FileHandler:
#@TODO package update event
#----------------------------------------------------------------------
+ @lock
@change
def addPackage(self, name, folder, queue=0):
"""adds a package, default to link collector"""
@@ -538,18 +541,21 @@ class FileDatabaseBackend(Thread):
def queue(func):
"""use as decorator when fuction directly executes sql commands"""
def new(*args):
+ #print "DataBase: %s args: %s" % (func, args[1:])
args[0].lock.acquire()
args[0].jobs.put((func, args, 0))
res = args[0].res.get()
args[0].lock.release()
+ #print "DataBase: %s return: %s" % (func, res)
return res
-
-
+
+
return new
def async(func):
"""use as decorator when function does not return anything and asynchron execution is wanted"""
def new(*args):
+ #print "DataBase async: %s args: %s" % (func, args[1:])
args[0].lock.acquire()
args[0].jobs.put((func, args, 1))
args[0].lock.release()
@@ -803,7 +809,7 @@ class FileDatabaseBackend(Thread):
@async
def updateLinkInfo(self, data):
""" data is list of tupels (name, size, status, url) """
- self.c.executemany('UPDATE links SET name=?, size=?, status=? WHERE url=? AND status NOT IN (0,12,13)', data)
+ self.c.executemany('UPDATE links SET name=?, size=?, status=? WHERE url=? AND status NOT IN (0,8,12,13)', data)
@queue
def reorderPackage(self, p, position, noMove=False):
diff --git a/module/ThreadManager.py b/module/ThreadManager.py
index 30c3630b1..d6bf155a5 100644
--- a/module/ThreadManager.py
+++ b/module/ThreadManager.py
@@ -202,7 +202,7 @@ class ThreadManager:
if job.plugin.__type__ == "hoster":
if free:
thread = free[0]
- self.downloaded += 1
+ #self.downloaded += 1
thread.put(job)
else:
diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py
index db0e856ab..ff6761d79 100644
--- a/module/plugins/hoster/NetloadIn.py
+++ b/module/plugins/hoster/NetloadIn.py
@@ -150,6 +150,7 @@ class NetloadIn(Hoster):
if not page:
page = self.load(self.url)
+ t = time() + 30
self.log.debug("Netload: try number %d " % i)
if self.getConf('dumpgen'):
@@ -192,9 +193,9 @@ class NetloadIn(Hoster):
file_id = re.search('<input name="file_id" type="hidden" value="(.*)" />', page).group(1)
if not captchawaited:
wait = self.get_wait_time(page)
- if i == 0: wait = 1 # wait only 1 sec contrary to time on website
- else: self.waitUntil = time
- self.log.info(_("Netload: waiting for captcha %d s.") % (t- time()))
+ if i == 0: self.waitUntil = time() # wait only 1 sec contrary to time on website
+ else: self.waitUntil = t
+ self.log.info(_("Netload: waiting for captcha %d s.") % (self.waitUntil - time()))
#self.setWait(wait)
self.wait()
captchawaited = True