diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2012-10-09 22:09:16 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2012-10-09 22:09:16 +0200 |
commit | 49c4088ceb02da735d549014aaa9cba8c729ba54 (patch) | |
tree | 9ae70f02f4c548b7e7d2409eef89505cbd1924db /module/database | |
parent | added nodejs as usuable js engine (diff) | |
download | pyload-49c4088ceb02da735d549014aaa9cba8c729ba54.tar.xz |
modified Api: filter downloads by state
Diffstat (limited to 'module/database')
-rw-r--r-- | module/database/FileDatabase.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/module/database/FileDatabase.py b/module/database/FileDatabase.py index e9ef99cbe..f3992465c 100644 --- a/module/database/FileDatabase.py +++ b/module/database/FileDatabase.py @@ -17,7 +17,7 @@ from new_collections import OrderedDict -from module.Api import DownloadInfo, FileInfo, PackageInfo, PackageStats +from module.Api import DownloadInfo, FileInfo, PackageInfo, PackageStats, DownloadState as DS, state_string from module.database import DatabaseMethods, queue, async, inner zero_stats = PackageStats(0, 0, 0, 0) @@ -37,7 +37,7 @@ class FileMethods(DatabaseMethods): return self.c.fetchone()[0] @queue - def processcount(self, fid, user=None): + def processcount(self, fid=-1, user=None): """ number of files which have to be processed """ # status in online, queued, starting, waiting, downloading self.c.execute("SELECT COUNT(*) FROM files WHERE dlstatus IN (2,3,8,9,10) AND fid != ?", (fid, )) @@ -112,7 +112,7 @@ class FileMethods(DatabaseMethods): self.c.execute('DELETE FROM collector WHERE owner=?', (owner,)) @queue - def getAllFiles(self, package=None, search=None, unfinished=False, owner=None): + def getAllFiles(self, package=None, search=None, state=None, owner=None): """ Return dict with file information :param package: optional package to filter out @@ -125,8 +125,8 @@ class FileMethods(DatabaseMethods): arg = [] - if unfinished: - qry += 'dlstatus NOT IN (0, 5, 6) AND ' + if state is not None and state != DS.All: + qry += 'dlstatus IN (%s) AND ' % state_string(state) if owner is not None: qry += 'owner=? AND ' arg.append(owner) |