X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/2c32c8ba80f56f7bc1b3561aea2dd25770c33fbd..f6d690f4f6d13acdaf4bae627c8cff6a1d93a198:/lib/python/Components/DreamInfoHandler.py diff --git a/lib/python/Components/DreamInfoHandler.py b/lib/python/Components/DreamInfoHandler.py index 858b99a2..f9bd479e 100644 --- a/lib/python/Components/DreamInfoHandler.py +++ b/lib/python/Components/DreamInfoHandler.py @@ -22,14 +22,13 @@ class InfoHandler(xml.sax.ContentHandler): self.elements = [] self.validFileTypes = ["skin", "config", "services", "favourites", "package"] self.prerequisitesMet = prerequisiteMet - - + def printError(self, error): print "Error in defaults xml files:", error raise InfoHandlerParseError, error def startElement(self, name, attrs): - print name, ":", attrs.items() + #print name, ":", attrs.items() self.elements.append(name) if name in ["hardware", "bcastsystem", "satellite", "tag"]: if not attrs.has_key("type"): @@ -63,11 +62,11 @@ class InfoHandler(xml.sax.ContentHandler): self.filetype = type self.fileattrs = attrs def endElement(self, name): - print "end", name - print "self.elements:", self.elements + #print "end", name + #print "self.elements:", self.elements self.elements.pop() if name == "file": - print "prerequisites:", self.prerequisites + #print "prerequisites:", self.prerequisites if len(self.prerequisites) == 0 or self.prerequisitesMet(self.prerequisites): if not self.attributes.has_key(self.filetype): self.attributes[self.filetype] = [] @@ -89,7 +88,7 @@ class InfoHandler(xml.sax.ContentHandler): self.attributes["author"] = str(data) if self.elements[-1] == "name": self.attributes["name"] = str(data) - print "characters", data + #print "characters", data class DreamInfoHandler: STATUS_WORKING = 0 @@ -110,6 +109,7 @@ class DreamInfoHandler: self.console = eConsoleAppContainer() self.console.appClosed.get().append(self.installNext) + self.reloadFavourites = False self.statusCallback = statusCallback self.setStatus(self.STATUS_INIT) @@ -144,7 +144,7 @@ class DreamInfoHandler: for package in self.packageslist[:]: if not self.prerequisiteMet(package[0]["prerequisites"]): self.packageslist.remove(package) - return packages + return self.packageslist def prerequisiteMet(self, prerequisites): # TODO: we need to implement a hardware detection here... @@ -157,11 +157,13 @@ class DreamInfoHandler: if prerequisites.has_key("tag"): if not self.neededTag in prerequisites["tag"]: return False + else: + return False if prerequisites.has_key("satellite"): for sat in prerequisites["satellite"]: if int(sat) not in nimmanager.getConfiguredSats(): - return False + return False if prerequisites.has_key("bcastsystem"): for bcastsystem in prerequisites["bcastsystem"]: if nimmanager.hasNimType(bcastsystem): @@ -198,6 +200,10 @@ class DreamInfoHandler: self.statusCallback(self.status, None) def installNext(self, *args, **kwargs): + if self.reloadFavourites: + self.reloadFavourites = False + db = eDVBDB.getInstance().reloadBouquets() + self.currentIndex += 1 attributes = self.installingAttributes #print "attributes:", attributes @@ -211,10 +217,13 @@ class DreamInfoHandler: else: print "increment meta index to install next package" self.currentlyInstallingMetaIndex += 1 + self.currentAttributeIndex = 0 self.installPackage(self.installIndexes[self.currentlyInstallingMetaIndex]) + return self.setStatus(self.STATUS_WORKING) + print "currentAttributeIndex:", self.currentAttributeIndex currentAttribute = self.attributeNames[self.currentAttributeIndex] print "installing", currentAttribute, "with index", self.currentIndex @@ -303,7 +312,8 @@ class DreamInfoHandler: def installFavourites(self, directory, name): print "installing favourites:", directory, " - ", name - + self.reloadFavourites = True + if self.blocking: os.system("cp %s %s" % ((directory + name), resolveFilename(SCOPE_CONFIG))) self.installNext()