diff options
Diffstat (limited to 'module/database/FileDatabase.py')
-rw-r--r-- | module/database/FileDatabase.py | 39 |
1 files changed, 1 insertions, 38 deletions
diff --git a/module/database/FileDatabase.py b/module/database/FileDatabase.py index d4514c710..f1c917b0a 100644 --- a/module/database/FileDatabase.py +++ b/module/database/FileDatabase.py @@ -194,7 +194,6 @@ class FileHandler: e = RemoveEvent("file", id, "collector" if not f.package().queue else "queue") oldorder = f.order - package = f.package if id in self.core.threadManager.processingIds(): self.cache[id].abortDownload() @@ -212,7 +211,7 @@ class FileHandler: pyfiles = self.cache.values() for pyfile in pyfiles: - if pyfile.packageid == package and pyfile.order > oldorder: + if pyfile.packageid == pid and pyfile.order > oldorder: pyfile.order -= 1 pyfile.notifyChange() @@ -576,11 +575,6 @@ class FileHandler: """ restart all failed links """ self.db.restartFailed() - @lock - @change - def fixPackageOrder(self, queue=0): - self.db.fixPackageOrder(queue) - class FileMethods(): @style.queue def filecount(self, queue): @@ -883,41 +877,10 @@ class FileMethods(): self.c.execute("DELETE FROM links WHERE status IN (0,4)") self.c.execute("DELETE FROM packages WHERE NOT EXISTS(SELECT 1 FROM links WHERE packages.id=links.package)") - @style.queue def restartFailed(self): self.c.execute("UPDATE links SET status=3,error='' WHERE status IN (8, 9)") - - @style.queue - def fixPackageOrder(self, queue=0): - found = 0 - order = 0 - i = 0 - self.c.execute("SELECT count(*) FROM packages WHERE queue = ?", (queue, )) - count = self.c.fetchone()[0] - if count == 0: - return - while order < count: - self.c.execute("SELECT id FROM packages WHERE packageorder = ? AND queue = ?", (i, queue)) - all = self.c.fetchall() - if len(all) == 0: - i += 1 - elif len(all) == 1: - self.c.execute("UPDATE packages SET packageorder=? WHERE id = ?", (order, all[0][0])) - order += 1 - i += 1 - elif len(all) > 1: - self.c.execute("UPDATE packages SET packageorder=? WHERE id = ?", (order, all[0][0])) - order += 1 - i += len(all) - del all[0] - self.c.execute("UPDATE packages SET packageorder=packageorder+? WHERE packageorder >= ? AND queue=?", (len(all), order, queue)) - for r in all: - self.c.execute("UPDATE packages SET packageorder=? WHERE id = ?", order, r[0]) - order += 1 - - @style.queue def findDuplicates(self, id, folder, filename): """ checks if filename exists with different id and same package """ |