diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-09-13 19:31:10 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-09-13 19:31:10 +0200 |
commit | e7ea8a420d01c927c17cf2db692cb0355aa87b95 (patch) | |
tree | fffd2c397b2fc300ca8086785d0898442e325531 /module/FileDatabase.py | |
parent | couldn't connect to host fix (diff) | |
download | pyload-e7ea8a420d01c927c17cf2db692cb0355aa87b95.tar.xz |
new package ui for webif
Diffstat (limited to 'module/FileDatabase.py')
-rw-r--r-- | module/FileDatabase.py | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/module/FileDatabase.py b/module/FileDatabase.py index 9d52396ae..37bd7b3c8 100644 --- a/module/FileDatabase.py +++ b/module/FileDatabase.py @@ -138,6 +138,14 @@ class FileHandler: return packs #---------------------------------------------------------------------- + def getInfoData(self, queue=1): + """gets a data representation without links""" + + packs = self.db.getAllPackages(queue) + packs.update([(str(x.id), x.toDict()[x.id]) for x in self.packageCache.itervalues() if x.queue == queue]) + + return packs + @lock @change def addLinks(self, urls, package): @@ -404,11 +412,21 @@ class FileHandler: @change def reorderPackage(self, id, position): p = self.db.getPackage(id) - + e = RemoveEvent("pack", id, "collector" if not p.queue else "queue") self.core.pullManager.addEvent(e) self.db.reorderPackage(p, position) + packs = self.packageCache.values() + p.order = position + for pack in packs: + if pack.queue != p.queue or pack.order < 0 or pack == p: continue + if pack.order > p.order: + pack.order -= 1 + if pack.order >= position: + pack.order += 1 + + p.order = position self.db.commit() @@ -637,6 +655,7 @@ class FileDatabaseBackend(Thread): data = {} for r in self.c: data[str(r[0])] = { + 'id': r[0], 'url': r[1], 'name': r[2], 'size': r[3], @@ -670,6 +689,7 @@ class FileDatabaseBackend(Thread): data = {} for r in self.c: data[str(r[0])] = { + 'id': r[0], 'name': r[1], 'folder': r[2], 'site': r[3], @@ -691,6 +711,7 @@ class FileDatabaseBackend(Thread): if not r: return None data[str(r[0])] = { + 'id': r[0], 'url': r[1], 'name': r[2], 'size': r[3], @@ -713,6 +734,7 @@ class FileDatabaseBackend(Thread): data = {} for r in self.c: data[str(r[0])] = { + 'id': r[0], 'url': r[1], 'name': r[2], 'size': r[3], @@ -903,6 +925,7 @@ class PyFile(): """ return { self.id: { + 'id': self.id, 'url': self.url, 'name': self.name, 'plugin': self.pluginname, @@ -1031,6 +1054,7 @@ class PyPackage(): """ return { self.id: { + 'id': self.id, 'name': self.name, 'folder': self.folder, 'site': self.site, |