def updateFileInfo(self, data, pid): """ updates file info (name, size, status, url)""" ids = self.db.updateLinkInfo(data) e = UpdateEvent( "pack", pid, "collector" if not self.getPackage(pid).queue else "queue") self.core.pullManager.addEvent(e)
def updatePackage(self, pypack): """updates a package""" self.db.updatePackage(pypack) e = UpdateEvent("pack", pypack.id, "collector" if not pypack.queue else "queue") self.core.pullManager.addEvent(e)
def updateLink(self, pyfile): """updates link""" self.db.updateLink(pyfile) e = UpdateEvent("file", pyfile.id, "collector" if not pyfile.package().queue else "queue") self.core.pullManager.addEvent(e)
def restartFile(self, id): """ restart file""" if id in self.cache: self.cache[id].status = 3 self.cache[id].name = self.cache[id].url self.cache[id].error = "" self.cache[id].abortDownload() self.db.restartFile(id) e = UpdateEvent("file", id, "collector" if not self.getFile(id).package().queue else "queue") get_pull_manager().addEvent(e)
def restartPackage(self, id): """restart package""" pyfiles = self.cache.values() for pyfile in pyfiles: if pyfile.packageid == id: self.restartFile(pyfile.id) self.db.restartPackage(id) if id in self.packageCache: self.packageCache[id].setFinished = False e = UpdateEvent("pack", id, "collector" if not self.getPackage(id).queue else "queue") get_pull_manager().addEvent(e)
def notifyChange(self): e = UpdateEvent("pack", self.id, "collector" if not self.queue else "queue") self.m.core.pullManager.addEvent(e)
def notifyChange(self): e = UpdateEvent("file", self.id, "collector" if not self.package().queue else "queue") get_pull_manager().addEvent(e)