summaryrefslogtreecommitdiffstats
path: root/module/database
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-03-18 19:04:48 +0100
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-03-18 19:04:48 +0100
commit5d32c05eb764beed8a84dec1e91e0f8a8060899d (patch)
treed4d71b48908c097bde2a3ec9c7c2b80d54b5eccd /module/database
parentrender download progress (diff)
downloadpyload-5d32c05eb764beed8a84dec1e91e0f8a8060899d.tar.xz
added ReadWrite lock, render file progress on dashboard
Diffstat (limited to 'module/database')
-rw-r--r--module/database/FileDatabase.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/module/database/FileDatabase.py b/module/database/FileDatabase.py
index 632961c2a..67a15912a 100644
--- a/module/database/FileDatabase.py
+++ b/module/database/FileDatabase.py
@@ -59,6 +59,8 @@ class FileMethods(DatabaseMethods):
r = self.c.fetchone()
return (r[0], r[1] if r[1] is not None else 0) if r else (0, 0)
+
+ # TODO: multi user?
@queue
def processcount(self, fid=-1, user=None):
""" number of files which have to be processed """
@@ -66,7 +68,16 @@ class FileMethods(DatabaseMethods):
self.c.execute("SELECT COUNT(*), SUM(size) FROM files WHERE dlstatus IN (2,3,8,9,10) AND fid != ?", (fid, ))
return self.c.fetchone()[0]
- # TODO: think about multiuser side effects on *count methods
+ @queue
+ def processstats(self, user=None):
+ if user is None:
+ self.c.execute("SELECT COUNT(*), SUM(size) FROM files WHERE dlstatus IN (2,3,8,9,10)")
+ else:
+ self.c.execute(
+ "SELECT COUNT(*), SUM(f.size) FROM files f, packages p WHERE f.package = p.pid AND dlstatus IN (2,3,8,9,10)",
+ user)
+ r = self.c.fetchone()
+ return (r[0], r[1] if r[1] is not None else 0) if r else (0, 0)
@queue
def addLink(self, url, name, plugin, package, owner):