X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/2d27932b3883a9e7a0e169caad004c16fd276808..ab26adc86e6198e65e20d6bf707a6011208111ce:/lib/python/Components/DreamInfoHandler.py diff --git a/lib/python/Components/DreamInfoHandler.py b/lib/python/Components/DreamInfoHandler.py index 833fea4c..900a2180 100644 --- a/lib/python/Components/DreamInfoHandler.py +++ b/lib/python/Components/DreamInfoHandler.py @@ -1,8 +1,9 @@ import xml.sax -from Tools.Directories import crawlDirectory, resolveFilename, SCOPE_CONFIG, SCOPE_SKIN +from Tools.Directories import crawlDirectory, resolveFilename, SCOPE_CONFIG, SCOPE_SKIN, copyfile, copytree from Components.NimManager import nimmanager from Components.Ipkg import IpkgComponent from Components.config import config, configfile +from Tools.HardwareInfo import HardwareInfo from enigma import eConsoleAppContainer, eDVBDB import os @@ -97,6 +98,7 @@ class DreamInfoHandler: STATUS_INIT = 4 def __init__(self, statusCallback, blocking = False, neededTag = None): + self.hardware_info = HardwareInfo() self.directory = "/" self.neededTag = neededTag @@ -165,14 +167,19 @@ class DreamInfoHandler: if int(sat) not in nimmanager.getConfiguredSats(): return False if prerequisites.has_key("bcastsystem"): + has_system = False for bcastsystem in prerequisites["bcastsystem"]: if nimmanager.hasNimType(bcastsystem): - return True - return False + has_system = True + if not has_system: + return False if prerequisites.has_key("hardware"): + hardware_found = False for hardware in prerequisites["hardware"]: - # TODO: hardware detection - met = True + if hardware == self.hardware_info.device_name: + hardware_found = True + if not hardware_found: + return False return True def installPackages(self, indexes): @@ -186,6 +193,10 @@ class DreamInfoHandler: self.installPackage(self.installIndexes[self.currentlyInstallingMetaIndex]) def installPackage(self, index): + print "self.packageslist:", self.packageslist + if len(self.packageslist) <= index: + print "no package with index", index, "found... installing nothing" + return print "installing package with index", index, "and name", self.packageslist[index][0]["attributes"]["name"] attributes = self.packageslist[index][0]["attributes"] @@ -208,7 +219,7 @@ class DreamInfoHandler: attributes = self.installingAttributes #print "attributes:", attributes - if self.currentAttributeIndex >= len(self.attributeNames) - 1: # end of package reached + if self.currentAttributeIndex >= len(self.attributeNames): # end of package reached print "end of package reached" if self.currentlyInstallingMetaIndex is None or self.currentlyInstallingMetaIndex >= len(self.installIndexes) - 1: print "set status to DONE" @@ -219,9 +230,11 @@ class DreamInfoHandler: 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 @@ -292,7 +305,7 @@ class DreamInfoHandler: print "installing skin:", directory, " - ", name print "cp -a %s %s" % (directory, resolveFilename(SCOPE_SKIN)) if self.blocking: - os.system("cp -a %s %s" % (directory, resolveFilename(SCOPE_SKIN))) + copytree(directory, resolveFilename(SCOPE_SKIN)) self.installNext() else: if self.console.execute("cp -a %s %s" % (directory, resolveFilename(SCOPE_SKIN))): @@ -311,9 +324,9 @@ 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))) + copyfile(directory + name, resolveFilename(SCOPE_CONFIG)) self.installNext() else: if self.console.execute("cp %s %s" % ((directory + name), resolveFilename(SCOPE_CONFIG))):