diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2013-03-18 19:04:48 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2013-03-18 19:04:48 +0100 |
commit | 5d32c05eb764beed8a84dec1e91e0f8a8060899d (patch) | |
tree | d4d71b48908c097bde2a3ec9c7c2b80d54b5eccd /module/database | |
parent | render download progress (diff) | |
download | pyload-5d32c05eb764beed8a84dec1e91e0f8a8060899d.tar.xz |
added ReadWrite lock, render file progress on dashboard
Diffstat (limited to 'module/database')
-rw-r--r-- | module/database/FileDatabase.py | 13 |
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): |