From 218ef6ec665fac20928d293e950458960f36c633 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Tue, 16 Aug 2011 20:11:57 +0200 Subject: plugin unloading, closed #377, some fixes --- module/database/DatabaseBackend.py | 6 +++--- module/database/FileDatabase.py | 15 +++++++-------- 2 files changed, 10 insertions(+), 11 deletions(-) (limited to 'module/database') diff --git a/module/database/DatabaseBackend.py b/module/database/DatabaseBackend.py index d330262f9..9530390c3 100644 --- a/module/database/DatabaseBackend.py +++ b/module/database/DatabaseBackend.py @@ -76,8 +76,8 @@ class DatabaseJob(): self.result = None self.exception = False - #import inspect - #self.frame = inspect.currentframe() +# import inspect +# self.frame = inspect.currentframe() def __repr__(self): from os.path import basename @@ -89,7 +89,7 @@ class DatabaseJob(): del frame del self.frame - return "DataBase Job %s:%s\n%s" % (self.f.__name__, self.args[1:], output) + return "DataBase Job %s:%s\n%sResult: %s" % (self.f.__name__, self.args[1:], output, self.result) def processJob(self): try: diff --git a/module/database/FileDatabase.py b/module/database/FileDatabase.py index 19205dac6..2ca7fd07d 100644 --- a/module/database/FileDatabase.py +++ b/module/database/FileDatabase.py @@ -356,20 +356,19 @@ class FileHandler: """checks if all files are finished and dispatch event""" if not self.getQueueCount(True): - #hope its not called together with all DownloadsProcessed - self.core.hookManager.dispatchEvent("allDownloadsProcessed") self.core.hookManager.dispatchEvent("allDownloadsFinished") self.core.log.debug("All downloads finished") return True return False - def checkAllLinksProcessed(self): - """checks if all files was processed and pyload would idle now""" + def checkAllLinksProcessed(self, fid): + """checks if all files was processed and pyload would idle now, needs fid which will be ignored when counting""" + # reset count so statistic will update (this is called when dl was processed) self.resetCount() - - if not self.db.processcount(1): + + if not self.db.processcount(1, fid): self.core.hookManager.dispatchEvent("allDownloadsProcessed") self.core.log.debug("All downloads processed") return True @@ -564,9 +563,9 @@ class FileMethods(): return self.c.fetchone()[0] @style.queue - def processcount(self, queue): + def processcount(self, queue, fid): """ number of files which have to be proccessed """ - self.c.execute("SELECT COUNT(*) FROM links as l INNER JOIN packages as p ON l.package=p.id WHERE p.queue=? AND l.status IN (2,3,5,7,12)", (queue, )) + self.c.execute("SELECT COUNT(*) FROM links as l INNER JOIN packages as p ON l.package=p.id WHERE p.queue=? AND l.status IN (2,3,5,7,12) AND l.id != ?", (queue, str(fid))) return self.c.fetchone()[0] @style.inner -- cgit v1.2.3