diff options
-rw-r--r-- | module/FileDatabase.py | 25 | ||||
-rwxr-xr-x | pyLoadCore.py | 7 |
2 files changed, 25 insertions, 7 deletions
diff --git a/module/FileDatabase.py b/module/FileDatabase.py index dde151cb3..80cbe85ac 100644 --- a/module/FileDatabase.py +++ b/module/FileDatabase.py @@ -146,6 +146,8 @@ class FileHandler: self.lock.acquire() + e = RemoveEvent("pack", id, "collector" if not self.getPackage(id).queue else "queue") + if self.packageCache.has_key(id): del self.packageCache[id] @@ -157,8 +159,6 @@ class FileHandler: pyfile.release() self.db.deletePackage(id) - - e = RemoveEvent("pack", id, "collector" if not self.getPackage(id).queue else "queue") self.core.pullManager.addEvent(e) self.lock.release() @@ -227,7 +227,11 @@ class FileHandler: data = self.db.getPackageData(id) - data.update( [ (str(x.id), x.toDbDict()[x.id]) for x in self.cache.itervalues() ] ) + tmplist = [] + for x in self.cache.itervalues(): + if int(x.toDbDict()[x.id]["package"]) == int(id): + tmplist.append((str(x.id), x.toDbDict()[x.id])) + data.update(tmplist) pack["links"] = data @@ -331,7 +335,20 @@ class FileHandler: e = UpdateEvent("file", id, "collector" if not self.getFile(id).package().queue else "queue") self.core.pullManager.addEvent(e) + + @change + def pushPackageToQueue(self, id): + """push package to queue""" + pack = self.db.getPackage(id) + + e = RemoveEvent("pack", id, "collector" if not pack.queue else "queue") + self.core.pullManager.addEvent(e) + pack.queue = 1 + self.db.updatePackage(pack) + + e = InsertEvent("pack", id, -1, "collector" if not pack.queue else "queue") + self.core.pullManager.addEvent(e) ######################################################################### @@ -675,7 +692,7 @@ class PyFile(): sleep(0.1) abort = False - self.plugin.req.abort = False + if self.plugin and self.plugin.req: self.plugin.req.abort = False def finishIfDone(self): """set status to finish and release file if every thread is finished with it""" diff --git a/pyLoadCore.py b/pyLoadCore.py index d66b69a42..40b87ab76 100755 --- a/pyLoadCore.py +++ b/pyLoadCore.py @@ -486,7 +486,9 @@ class ServerMethods(): return self.core.files.getPackageData(int(id)) def get_file_data(self, id): - return self.core.files.getFileData(id) + info = self.core.files.getFileData(int(id)) + info = {str(info.keys()[0]): info[info.keys()[0]]} + return info def del_links(self, ids): for id in ids: @@ -519,8 +521,7 @@ class ServerMethods(): pass def push_package_to_queue(self, id): - #@TODO implement - pass + self.core.files.pushPackageToQueue(id) def restart_package(self, packid): self.core.files.restartPackage(int(packid)) |