summaryrefslogtreecommitdiffstats
path: root/module/FileDatabase.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/FileDatabase.py')
-rw-r--r--module/FileDatabase.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/module/FileDatabase.py b/module/FileDatabase.py
index 5085bc16a..b52acd4d0 100644
--- a/module/FileDatabase.py
+++ b/module/FileDatabase.py
@@ -522,13 +522,19 @@ class FileDatabaseBackend(Thread):
@queue
def getJob(self, occ):
- if len(occ) == 1:
- occ = "(%)" % str(occ)
- else:
- occ = str(occ)
-
"""return pyfile instance, which is suitable for download and dont use a occupied plugin"""
- self.c.execute("SELECT l.id FROM links as l INNER JOIN packages as p ON l.package=p.id WHERE p.queue=1 AND l.plugin NOT IN %s AND l.status IN (2,3,6) LIMIT 5" % occ) # very bad!
+
+ cmd = "("
+ i = 0
+ for item in occ:
+ if i != 0: cmd += ", "
+ cmd += "'%s'" % item
+
+ cmd += ")"
+
+ cmd = "SELECT l.id FROM links as l INNER JOIN packages as p ON l.package=p.id WHERE p.queue=1 AND l.plugin NOT IN %s AND l.status IN (2,3,6) LIMIT 5" % cmd
+
+ self.c.execute(cmd) # very bad!
return [x[0] for x in self.c ]