コード例 #1
0
    def updateMeta(self):
        try:
            self["itemname"].setText(
                _(str(self["menu"].l.getCurrentSelection()[0][1])))
            self["author"].setText(_("loading..."))
            self["votes"].setText(
                str(self["menu"].l.getCurrentSelection()[0][6]))
            self["date"].setText(
                str(self["menu"].l.getCurrentSelection()[0][5]))
            self["description"].setText(
                str(self["menu"].l.getCurrentSelection()[0][10]))
            self.currentid = str(self["menu"].l.getCurrentSelection()[0][0])
            self.currenttype = str(self["menu"].l.getCurrentSelection()[0][7])
            self.currentauthor = str(
                self["menu"].l.getCurrentSelection()[0][2])

            id = self.currentid
            type = self.currenttype
            path = config.plugins.MyMetrix.SkinPartPath.value + type + "s/active/" + type + "_" + str(
                id) + "/"
            if os.path.exists(path):
                self["isInstalled"].setText("Already installed!")
            else:
                self["isInstalled"].setText("")
        except Exception, e:
            self["itemname"].setText(_("No SkinParts available!"))
            self["author"].setText("")
            metrixTools.log("No SkinParts availbable in this view")
コード例 #2
0
ファイル: metrixCloudSync.py プロジェクト: iMaxxx/OpenStore
def syncNow(sync_data):
	try:
		url = metrixDefaults.URL_STORE_API + 'set.info'
		params = {'data':sync_data}
		metrixCore.getWeb(url,True,params)
	except:
		metrixTools.log("Error on sync")
コード例 #3
0
def installMetrixColors(item_name):
	try:
		data = metrixCore.getWeb(metrixDefaults.URL_GET_METRIXCOLORS,True,{'name':item_name})
		dom = parseString(data)
		for design in dom.getElementsByTagName('design'):
			name = str(design.getAttributeNode('name').nodeValue)
			if name == item_name:
				try:
					config.plugins.MyMetrix.Color.BackgroundTransparency.value = str(design.getAttributeNode('backgroundtrans').nodeValue)
					config.plugins.MyMetrix.Color.SelectionTransparency.value = str(design.getAttributeNode('selectiontrans').nodeValue)
					config.plugins.MyMetrix.Color.BackgroundTextTransparency.value = str(design.getAttributeNode('backgroundtexttrans').nodeValue)
					config.plugins.MyMetrix.Color.Selection.value = str(design.getAttributeNode('selection').nodeValue)
					config.plugins.MyMetrix.Color.ProgressBar.value = str(design.getAttributeNode('progressbars').nodeValue)
					config.plugins.MyMetrix.Color.Background.value = str(design.getAttributeNode('background').nodeValue)
					config.plugins.MyMetrix.Color.Background2.value = str(design.getAttributeNode('background2').nodeValue)
					config.plugins.MyMetrix.Color.Foreground.value = str(design.getAttributeNode('foreground').nodeValue)
					config.plugins.MyMetrix.Color.BackgroundText.value = str(design.getAttributeNode('backgroundtext').nodeValue)
					config.plugins.MyMetrix.Color.Accent1.value = str(design.getAttributeNode('accent1').nodeValue)
					config.plugins.MyMetrix.Color.Accent2.value = str(design.getAttributeNode('accent2').nodeValue)
					
					config.plugins.MyMetrix.Color.Selection_Custom.value = metrixTools.toRGB(str(design.getAttributeNode('selection_custom').nodeValue))
					config.plugins.MyMetrix.Color.Background_Custom.value = metrixTools.toRGB(str(design.getAttributeNode('background_custom').nodeValue))
					config.plugins.MyMetrix.Color.Background2_Custom.value = metrixTools.toRGB(str(design.getAttributeNode('background2_custom').nodeValue))
					config.plugins.MyMetrix.Color.Foreground_Custom.value = metrixTools.toRGB(str(design.getAttributeNode('foreground_custom').nodeValue))
					config.plugins.MyMetrix.Color.BackgroundText_Custom.value = metrixTools.toRGB(str(design.getAttributeNode('backgroundtext_custom').nodeValue))
					config.plugins.MyMetrix.Color.Accent1_Custom.value = metrixTools.toRGB(str(design.getAttributeNode('accent1_custom').nodeValue))
					config.plugins.MyMetrix.Color.Accent2_Custom.value = metrixTools.toRGB(str(design.getAttributeNode('accent2_custom').nodeValue))
					return True
				except Exception, e:
					metrixTools.log("Error setting MetrixColor!",e)
	except Exception, e:
		metrixTools.log("Error downloading MetrixColor!",e)
コード例 #4
0
def downloadAdditionalFiles(url,
                            target_path,
                            searchpattern="",
                            replacepattern="",
                            forceOverwrite=True,
                            urlparameters=""):
    try:
        data = metrixCore.getWeb(url, True)
        #print(data)

        dom = parseString(data)

        for file in dom.getElementsByTagName('entry'):
            url = str(file.getAttributeNode('url').nodeValue) + urlparameters
            file_name = str(
                file.getAttributeNode('url').nodeValue).split('file=')[-1]
            if not os.path.exists(target_path):
                os.makedirs(target_path)
            if metrixTools.downloadFile(url, target_path + file_name,
                                        searchpattern, replacepattern,
                                        forceOverwrite) == None:
                return False
                metrixTools.log("Error downloading file!")
        return True
    except Exception, e:
        metrixTools.log("No additional files available!", e)
        return False
コード例 #5
0
ファイル: metrixConnector.py プロジェクト: iMaxxx/OpenStore
def installSkinPart(param,actionId):
	metrixTools.log("Installing skinpart: "+param)
	item_id = ""
	item_name = ""
	item_type = ""
	author = ""
	date_modified = ""
	try:
		data = metrixCore.getWeb(metrixDefaults.URL_GET_SKINPART_META_UPDATE + "&id=" + str(param),False)
		dom = parseString(data)
		for entry in dom.getElementsByTagName('entry'):
			item_id = str(entry.getAttributeNode('id').nodeValue)
			item_name = str(entry.getAttributeNode('name').nodeValue)
			item_type = str(entry.getAttributeNode('type').nodeValue)
			author = str(entry.getAttributeNode('author').nodeValue)
			image_link = str(entry.getAttributeNode('image_link').nodeValue)
			date = str(entry.getAttributeNode('date').nodeValue)
			date_modified = str(entry.getAttributeNode('date_modified').nodeValue)
			if item_type == "bundle":
				metrix_SkinPartTools.installBundle(item_id,type,author)
			else:
				metrix_SkinPartTools.installSkinPart(item_id,item_type,author,image_link)
				showInfo(item_name+" "+_("successfully installed!"))
			
	except Exception, e:
		metrixTools.log("Error installing SkinPart",e)
		traceback.print_exc()
コード例 #6
0
ファイル: store_Updater.py プロジェクト: Temporalis/OpenStore
def getUpdatedPackages():
    menu = []
    try:
        params = {
            "restriction-oe": metrixTools.getOERestriction(),
            "restriction-image": metrixTools.getImageRestriction(),
            "category_id": "%",
        }
        data = metrixCore.getWeb(metrixDefaults.URL_GET_PACKAGES, True, params)
        if "<exception status=" "error" "" in data:
            raise Exception("Error loading data")
        dom = parseString(data)
        for package in dom.getElementsByTagName("entry"):
            isinstalled = False
            updateavailable = False
            item_id = str(package.getAttributeNode("id").nodeValue)
            file_link = str(package.getAttributeNode("file_link").nodeValue)
            build = int(package.getAttributeNode("build").nodeValue)
            localbuild = int(metrixDefaults.cfg(metrixDefaults.CONFIG_INSTALLEDPACKAGES, item_id, "build", "int"))
            # add when not only updates or (only updates and online build is higher)
            if not localbuild == metrixDefaults.NONEINT:
                isinstalled = True
            if build > localbuild:
                updateavailable = True
                metrix_PackageTools.installPackage(file_link, True, True, item_id, build)
                config.plugins.MetrixUpdater.RebootRequired.value = True
    except Exception, e:
        metrixTools.log("Error getting packages via web", e)
コード例 #7
0
def installPackage(url,force=False,silent=False,id=0,build=0):
	downloadDir = '/tmp/openstore/'
	if not os.path.exists(downloadDir):
		os.makedirs(downloadDir)
	metrixTools.log("Installing package "+url,None,"OpenStore")
	packagefile = metrixTools.downloadFile(url,downloadDir + 'package.ipk',forceOverwrite=True)
	packagename = getPackageName(downloadDir,"package.ipk")
	if force:
		cmdStatus = runCommand("opkg install --force-overwrite '"+packagefile+"'")
	else:
		cmdStatus = runCommand("opkg install '"+packagefile+"'")
	if cmdStatus[0] == True:
		if not id == 0:
			metrixDefaults.cfgset(metrixDefaults.CONFIG_INSTALLEDPACKAGES,id,"id",id)
			try:
				metrixDefaults.cfgset(metrixDefaults.CONFIG_INSTALLEDPACKAGES,id,"name",packagename)
			except:
				pass
			metrixDefaults.cfgset(metrixDefaults.CONFIG_INSTALLEDPACKAGES,id,"build",build)
			metrixDefaults.cfgset(metrixDefaults.CONFIG_INSTALLEDPACKAGES,id,"url",url)
		config.plugins.MetrixUpdater.Reboot.value = 1
		config.plugins.MetrixUpdater.save()    
		configfile.save()
		if not silent:
			metrixConnector.showInfo(_("Package successfully installed!"))
		return True
	else:
		if not silent:
			metrixConnector.showInfo(_("Error installing Package!"),MessageBox.TYPE_ERROR)
		return False
	if os.path.exists(downloadDir):
		os.removedirs(downloadDir)
	syncPackages()
コード例 #8
0
ファイル: metrixConnector.py プロジェクト: andgoldi/OpenStore
def installSkinPart(param,actionId):
	metrixTools.log("Installing skinpart: "+param)
	item_id = ""
	item_name = ""
	item_type = ""
	author = ""
	date_modified = ""
	try:
		data = metrixCore.getWeb(metrixDefaults.URL_GET_SKINPART_META_UPDATE + "&id=" + str(param),False)
		dom = parseString(data)
		for entry in dom.getElementsByTagName('entry'):
			item_id = str(entry.getAttributeNode('id').nodeValue)
			item_name = str(entry.getAttributeNode('name').nodeValue)
			item_type = str(entry.getAttributeNode('type').nodeValue)
			author = str(entry.getAttributeNode('author').nodeValue)
			image_link = str(entry.getAttributeNode('image_link').nodeValue)
			date = str(entry.getAttributeNode('date').nodeValue)
			date_modified = str(entry.getAttributeNode('date_modified').nodeValue)
			if item_type == "bundle":
				metrix_SkinPartTools.installBundle(item_id,type,author)
			else:
				metrix_SkinPartTools.installSkinPart(item_id,item_type,author,image_link)
				showInfo(item_name+" "+_("successfully installed!"))
			
	except Exception, e:
		metrixTools.log("Error installing SkinPart",e)
		traceback.print_exc()
コード例 #9
0
ファイル: store_Updater.py プロジェクト: andgoldi/OpenStore
def getUpdatedPackages():
		menu = []
		try:
			params = {'restrictions':metrixTools.getRestrictions(),
					  'category_id':"%"}
			data = metrixCore.getWeb(metrixDefaults.URL_GET_PACKAGES,True,params)
			if "<exception status=""error""" in data:
				raise Exception("Error loading data")
			dom = parseString(data)
			for design in dom.getElementsByTagName('entry'):
				isinstalled = False
				updateavailable = False
				item_id = str(design.getAttributeNode('id').nodeValue)
				file_link = str(design.getAttributeNode('file_link').nodeValue)
				build = int(design.getAttributeNode('build').nodeValue)
				localbuild = int(metrixDefaults.cfg(metrixDefaults.CONFIG_INSTALLEDPACKAGES,item_id,"build","int"))
				# add when not only updates or (only updates and online build is higher)
				if (not localbuild == metrixDefaults.NONEINT):
					isinstalled = True
				if build > localbuild:
					updateavailable = True
				if build > localbuild:
					metrix_PackageTools.installPackage(file_link,True,True,item_id,build)
					config.plugins.MetrixUpdater.RebootRequired.value = True
					config.plugins.MetrixUpdater.UpdatePopup_Packages.value = True
		except Exception, e:
			metrixTools.log('Error getting packages via web',e)
コード例 #10
0
	def generateSkin(self):
		screennames = [] 
		screennames = self.getSkinPartsScreennames(config.plugins.MyMetrix.SkinPartPath.value + "screens/active/")
		metrixTools.callOnMainThread(self["output"].setText,_("Reading template file"))
		skindom = parse(config.plugins.MyMetrix.Templates.value)
		skinNode = skindom.getElementsByTagName('skin')[0]
		
		metrixTools.callOnMainThread(self["output"].setText,_("Setting colors"))
		self.setColor(skinNode)
		for screen in skindom.getElementsByTagName('screen'):
			screenname = str(screen.getAttributeNode('name').nodeValue)
			
			metrixTools.callOnMainThread(self["output"].setText,(str(_("Checking screen ")+screenname)))
			if screenname in screennames:
				metrixTools.callOnMainThread(self["output"].setText,_(str("Removing default screen "+screenname)))
				parentNode = screen.parentNode
				parentNode.removeChild(screen)
			if config.plugins.MyMetrix.CleanInfoBar.value:
				if screenname == "InfoBar" or screenname == "SecondInfoBar":
					for child in screen.childNodes:
						screen.removeChild(child)
				
		# APPEND STORE SCREENS
		path = config.plugins.MyMetrix.SkinPartPath.value + "screens/active/"
		dirs = listdir(path)
		for dir in dirs:
			metrixTools.callOnMainThread(self["output"].setText,_("Parsing SkinPart Screens"))
			try:	
				screen = metrix_SkinPartTools.parseSkinPart(path+dir,"data.xml","config.cfg",screenname)
				customscreen = skindom.importNode(screen, True)
				skinNode.appendChild(customscreen)
			except Exception, e:
				metrixTools.log("Error appending screen",e)
コード例 #11
0
ファイル: metrixCloudSync.py プロジェクト: iMaxxx/OpenStore
def syncNow(sync_data):
    try:
        url = metrixDefaults.URL_STORE_API + 'set.info'
        params = {'data': sync_data}
        metrixCore.getWeb(url, True, params)
    except:
        metrixTools.log("Error on sync")
コード例 #12
0
	def getCategories(self):
		menu = []
		menu.append(self.CategoryListEntry(_("Loading...")))
		metrixTools.callOnMainThread(self.setList,menu)
		try:
			data = metrixCore.getWeb(self.url,True)
			dom = parseString(data)
			menu = []
			## ADD STATIC PSEUDO CATEGORIES
			menu.append(self.CategoryListEntry(_("Skins"), "Skins","skins"))
			menu.append(self.CategoryListEntry(_("MetrixColors"), "MetrixColors","brush"))
			menu.append(self.CategoryListEntry(_("Newest SkinParts"), "newest","new"))
			menu.append(self.CategoryListEntry(_("Last Modified"), "modified","recent"))
			menu.append(self.CategoryListEntry(_("Top 50 Downloads"), "mostdownloaded","download"))
			menu.append(self.CategoryListEntry(_("Skin Extensions"), "Extensions","extensions"))
			menu.append(self.CategoryListEntry(_("Bundles"), "bundle","bundle"))
			metrixTools.callOnMainThread(self.setList,menu)
			for entry in dom.getElementsByTagName('entry'):
				item_id = str(entry.getAttributeNode('id').nodeValue)
				name = str(entry.getAttributeNode('name').nodeValue)
				menu.append(self.CategoryListEntry(name, item_id))
				metrixTools.callOnMainThread(self.setList,menu)
		except Exception, e:
			metrixTools.log("Error getting items via web",e)
			menu.append(self.CategoryListEntry(_("Error loading data!"), "-","-"))
			metrixTools.callOnMainThread(self.setList,menu)
コード例 #13
0
ファイル: store_Updater.py プロジェクト: iMaxxx/OpenStore
def getUpdatedPackages():
		menu = []
		try:
			params = {'restriction-oe':metrixTools.getOERestriction(),
					'restriction-image':metrixTools.getImageRestriction(),
					  'category_id':"%"}
			data = metrixCore.getWeb(metrixDefaults.URL_GET_PACKAGES,True,params)
			if "<exception status=""error""" in data:
				raise Exception("Error loading data")
			dom = parseString(data)
			for package in dom.getElementsByTagName('entry'):
				isinstalled = False
				updateavailable = False
				item_id = str(package.getAttributeNode('id').nodeValue)
				file_link = str(package.getAttributeNode('file_link').nodeValue)
				build = int(package.getAttributeNode('build').nodeValue)
				localbuild = int(metrixDefaults.cfg(metrixDefaults.CONFIG_INSTALLEDPACKAGES,item_id,"build","int"))
				# add when not only updates or (only updates and online build is higher)
				if (not localbuild == metrixDefaults.NONEINT):
					isinstalled = True
				if build > localbuild:
					updateavailable = True
					metrix_PackageTools.installPackage(file_link,True,True,item_id,build)
					config.plugins.MetrixUpdater.RebootRequired.value = True
		except Exception, e:
			metrixTools.log('Error getting packages via web',e)
コード例 #14
0
ファイル: metrixConnector.py プロジェクト: andgoldi/OpenStore
def syncActions():
	syncinterval =1200
	while(1):
		if metrixCore.isLoggedIn():
			try:
				getActions()
				syncinterval = getInterval()
			except:
				metrixTools.log("Error getting interval")
		time.sleep(syncinterval)
コード例 #15
0
ファイル: metrixConnector.py プロジェクト: iMaxxx/OpenStore
def syncActions():
	syncinterval = 20 * 60
	while(1):
		if metrixCore.isLoggedIn():
			try:
				getActions()
				syncinterval = getInterval()
			except:
				metrixTools.log("Error getting interval")
		time.sleep(syncinterval)
コード例 #16
0
def GetWeather():
    woeid = config.plugins.MetrixWeather.woeid.value
    metrixTools.log("Lookup for ID " + str(woeid), None, "MetrixWeather")
    url = "http://query.yahooapis.com/v1/public/yql?q=select%20item%20from%20weather.forecast%20where%20woeid%3D%22" + str(
        woeid) + "%22&format=xml"
    #url = "http://query.yahooapis.com/v1/public/yql?q=select%20item%20from%20weather.forecast%20where%20woeid%3D%22"+str(woeid)+"%22%20u%3Dc&format=xml"

    # where location in (select id from weather.search where query="oslo, norway")
    file = urllib.urlopen(url)
    data = file.read()
    file.close()

    dom = parseString(data)
    title = getTextNode(dom.getElementsByTagName('title')[0].childNodes)
    config.plugins.MetrixWeather.currentLocation.value = str(title).split(
        ',')[0].replace("Conditions for ", "")

    currentWeather = dom.getElementsByTagName('yweather:condition')[0]
    currentWeatherCode = currentWeather.getAttributeNode('code')
    config.plugins.MetrixWeather.currentWeatherCode.value = ConvertCondition(
        currentWeatherCode.nodeValue)
    currentWeatherTemp = currentWeather.getAttributeNode('temp')
    config.plugins.MetrixWeather.currentWeatherTemp.value = getTemp(
        currentWeatherTemp.nodeValue)
    currentWeatherText = currentWeather.getAttributeNode('text')
    config.plugins.MetrixWeather.currentWeatherText.value = currentWeatherText.nodeValue

    currentWeather = dom.getElementsByTagName('yweather:forecast')[0]
    currentWeatherCode = currentWeather.getAttributeNode('code')
    config.plugins.MetrixWeather.forecastTodayCode.value = ConvertCondition(
        currentWeatherCode.nodeValue)
    currentWeatherTemp = currentWeather.getAttributeNode('high')
    config.plugins.MetrixWeather.forecastTodayTempMax.value = getTemp(
        currentWeatherTemp.nodeValue)
    currentWeatherTemp = currentWeather.getAttributeNode('low')
    config.plugins.MetrixWeather.forecastTodayTempMin.value = getTemp(
        currentWeatherTemp.nodeValue)
    currentWeatherText = currentWeather.getAttributeNode('text')
    config.plugins.MetrixWeather.forecastTodayText.value = currentWeatherText.nodeValue

    currentWeather = dom.getElementsByTagName('yweather:forecast')[1]
    currentWeatherCode = currentWeather.getAttributeNode('code')
    config.plugins.MetrixWeather.forecastTomorrowCode.value = ConvertCondition(
        currentWeatherCode.nodeValue)
    currentWeatherTemp = currentWeather.getAttributeNode('high')
    config.plugins.MetrixWeather.forecastTomorrowTempMax.value = getTemp(
        currentWeatherTemp.nodeValue)
    currentWeatherTemp = currentWeather.getAttributeNode('low')
    config.plugins.MetrixWeather.forecastTomorrowTempMin.value = getTemp(
        currentWeatherTemp.nodeValue)
    currentWeatherText = currentWeather.getAttributeNode('text')
    config.plugins.MetrixWeather.forecastTomorrowText.value = currentWeatherText.nodeValue
    config.plugins.MetrixWeather.save()
    configfile.save()
コード例 #17
0
	def updateMeta(self):
		try:
			self["itemname"].setText(str(self["menu"].l.getCurrentSelection()[0][1]))
			self.setTitle(_("OpenStore // "+self["menu"].l.getCurrentSelection()[0][1]))
			self["author"].setText(_("loading..."))
			self["votes"].setText(str(self["menu"].l.getCurrentSelection()[0][6]))
			self["date"].setText(str(self["menu"].l.getCurrentSelection()[0][5]))
			self["description"].setText(str(self["menu"].l.getCurrentSelection()[0][10]))
			self.currentid = int(self["menu"].l.getCurrentSelection()[0][0])
			self.currenttype = str(self["menu"].l.getCurrentSelection()[0][7])
			isinstalled = self["menu"].l.getCurrentSelection()[0][15]
			updateavailable = self["menu"].l.getCurrentSelection()[0][16]
			if isinstalled:
				self["yellowbutton"].setText(_("Vote"))
				packageName = metrixDefaults.cfg(metrixDefaults.CONFIG_INSTALLEDPACKAGES,self.currentid,"name")
				if not packageName == "":
					self["redbutton"].setText(_("Remove"))
				else:
					self["redbutton"].setText("")
				if updateavailable:
					self["isInstalled"].setText(_("Update available!"))
					self["greenbutton"].setText(_("Update"))
				else:
					self["isInstalled"].setText(_("This app is installed!"))
					self["greenbutton"].setText(_("Reinstall"))
					
			else:
				type = self["menu"].l.getCurrentSelection()[0][7]
				if type == "piconrepo" and config.plugins.MyMetrix.XPiconsRepository.value == self.currentid:
					self["yellowbutton"].setText("Vote")
				else:
					self["yellowbutton"].setText("")
				self["redbutton"].setText("")
				if self.currenttype == "piconrepo":
					self["greenbutton"].setText(_("Apply"))
					if config.plugins.MyMetrix.XPiconsRepository.value == self.currentid:
						self["greenbutton"].setText("")
						
				else:
					self["greenbutton"].setText(_("Install"))
				self["isInstalled"].setText("")
			path = metrixDefaults.pathRoot()+"packages/"+str(self.currentid)+"/"
			
				
		except Exception, e:
			self["itemname"].setText(_("No packages available!"))
			self["author"].setText("")
			self["votes"].setText("")
			self["redbutton"].setText("")
			self["greenbutton"].setText("")
			self["yellowbutton"].setText("")
			self["description"].setText("")
			self["date"].setText("")
			metrixTools.log("No packages available in this view!",e)
コード例 #18
0
	def updateMeta(self):
		try:
			self["itemname"].setText(str(self["menu"].l.getCurrentSelection()[0][1]))
			self.setTitle(_("OpenStore // "+self["menu"].l.getCurrentSelection()[0][1]))
			self["author"].setText(_("loading..."))
			self["votes"].setText(str(self["menu"].l.getCurrentSelection()[0][6]))
			self["date"].setText(str(self["menu"].l.getCurrentSelection()[0][5]))
			self["description"].setText(str(self["menu"].l.getCurrentSelection()[0][10]))
			self.currentid = int(self["menu"].l.getCurrentSelection()[0][0])
			self.currenttype = str(self["menu"].l.getCurrentSelection()[0][7])
			isinstalled = self["menu"].l.getCurrentSelection()[0][15]
			updateavailable = self["menu"].l.getCurrentSelection()[0][16]
			if isinstalled:
				self["yellowbutton"].setText(_("Vote"))
				packageName = metrixDefaults.cfg(metrixDefaults.CONFIG_INSTALLEDPACKAGES,self.currentid,"name")
				if not packageName == "":
					self["redbutton"].setText(_("Remove"))
				else:
					self["redbutton"].setText("")
				if updateavailable:
					self["isInstalled"].setText(_("Update available!"))
					self["greenbutton"].setText(_("Update"))
				else:
					self["isInstalled"].setText(_("This app is installed!"))
					self["greenbutton"].setText(_("Reinstall"))
					
			else:
				type = self["menu"].l.getCurrentSelection()[0][7]
				if type == "piconrepo" and config.plugins.MyMetrix.XPiconsRepository.value == self.currentid:
					self["yellowbutton"].setText("Vote")
				else:
					self["yellowbutton"].setText("")
				self["redbutton"].setText("")
				if self.currenttype == "piconrepo":
					self["greenbutton"].setText(_("Apply"))
					if config.plugins.MyMetrix.XPiconsRepository.value == self.currentid:
						self["greenbutton"].setText("")
						
				else:
					self["greenbutton"].setText(_("Install"))
				self["isInstalled"].setText("")
			path = metrixDefaults.pathRoot()+"packages/"+str(self.currentid)+"/"
			
				
		except Exception, e:
			self["itemname"].setText(_("No packages available!"))
			self["author"].setText("")
			self["votes"].setText("")
			self["redbutton"].setText("")
			self["greenbutton"].setText("")
			self["yellowbutton"].setText("")
			self["description"].setText("")
			self["date"].setText("")
			metrixTools.log("No packages available in this view!",e)
コード例 #19
0
ファイル: metrixConnector.py プロジェクト: iMaxxx/OpenStore
def runCommand(cmd_type,param,actionId):
	metrixTools.log("Starting action via web")
	try:
		cmdStatus = metrix_PackageTools.runCommand(str(base64.b64decode(cmd_type)+" "+base64.b64decode(param)))
		if cmdStatus[0] == True:
			showInfo(_("Action successfully executed!"))
		else:
			showInfo(_("Error executing action!"),MessageBox.TYPE_ERROR)
			
	except Exception, e:
		metrixTools.log("Error on action via web",e)
コード例 #20
0
ファイル: metrixConnector.py プロジェクト: andgoldi/OpenStore
def runCommand(cmd_type,param,actionId):
	metrixTools.log("Starting action via web")
	try:
		cmdStatus = metrix_PackageTools.runCommand(str(base64.b64decode(cmd_type)+" "+base64.b64decode(param)))
		if cmdStatus[0] == True:
			showInfo(_("Action successfully executed!"))
		else:
			showInfo(_("Error executing action!"),MessageBox.TYPE_ERROR)
			
	except Exception, e:
		metrixTools.log("Error on action via web",e)
コード例 #21
0
def runCommand(command):
	try:
		process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE,stderr=subprocess.PIPE)
		process.wait()
		stdout, stderr = process.communicate(str.encode('utf-8'))
		if(stderr!=""):
			return [False,stderr]
		else:
			return [True,stdout]
	except Exception, e:
		metrixTools.log("Error running command",e,"OpenStore")
		return 0
コード例 #22
0
    def generateSkin(self):
        screennames = []
        screennames = self.getSkinPartsScreennames(
            config.plugins.MyMetrix.SkinPartPath.value + "screens/active/")
        metrixTools.callOnMainThread(self["output"].setText,
                                     _("Reading template file"))
        skindom = parse(config.plugins.MyMetrix.Templates.value)
        skinNode = skindom.getElementsByTagName('skin')[0]

        metrixTools.callOnMainThread(self["output"].setText,
                                     _("Setting colors"))
        self.setColor(skinNode)
        for screen in skinNode.getElementsByTagName('screen'):
            screenname = str(screen.getAttributeNode('name').nodeValue)

            metrixTools.callOnMainThread(
                self["output"].setText,
                (str(_("Checking screen ") + screenname)))
            if screenname in screennames:
                metrixTools.callOnMainThread(
                    self["output"].setText,
                    _(str("Removing default screen " + screenname)))
                parentNode = screen.parentNode
                parentNode.removeChild(screen)
            if config.plugins.MyMetrix.CleanInfoBar.value:
                if screenname in [
                        "InfoBar", "SecondInfoBar", "Nab_ExtraInfobar"
                ]:
                    ib = skindom.createElement("screen")
                    ib.setAttribute('backgroundColor', 'transparent')
                    ib.setAttribute('flags', 'wfNoBorder')
                    ib.setAttribute('name', screenname)
                    ib.setAttribute('position', '0,0')
                    ib.setAttribute('size', '1280,720')
                    ib.setAttribute('title', "InfoBar")
                    skinNode.appendChild(ib)
                    print "############################ append " + screenname

        # APPEND STORE SCREENS
        path = config.plugins.MyMetrix.SkinPartPath.value + "screens/active/"
        dirs = listdir(path)
        for dir in dirs:
            metrixTools.callOnMainThread(self["output"].setText,
                                         _("Parsing SkinPart Screens"))
            try:
                screen = metrix_SkinPartTools.parseSkinPart(
                    path + dir, "data.xml", "config.cfg", screenname)
                customscreen = skindom.importNode(screen, True)
                skinNode.appendChild(customscreen)
            except Exception, e:
                metrixTools.log("Error appending screen", e)
コード例 #23
0
ファイル: metrix_Intro.py プロジェクト: Temporalis/OpenStore
	def __init__(self, session):
		self["title"] = Label(_("Welcome to MyMetrix!"))
		self["description"] = Label(_("MyMetrix brings your set-top box experience onto a whole new level!\nPress left button to start the easy setup which generates the default MetrixHD feeling. Alternatively press right button to explore great SkinParts in OpenStore and customize your user interface how ever you want!"))
		Screen.__init__(self, session)
		self.session = session
		self["right"] = Label(_("Customize"))
		self["left"] = Label(_("Easy setup"))
		#self["helperimage"].instance.setPixmapFromFile("/usr/lib/enigma2/python/Plugins/Extensions/MyMetrix/images/nopreview.png")
		
		config.plugins.MyMetrix.showFirstRun.value = False
		config.plugins.MyMetrix.showFirstRun.save()
		try:
			configfile.save()
		except Exception, e:
			metrixTools.log("Error writing config file",e,"MetrixInto")
コード例 #24
0
	def getSkinParts(self,isactive=""):
		menu = []
		
		try:
			if self.pagelength == 0:
				params = {'screenname':self.screenname,
						'suite_id':self.suite_id,
						'developer':str(config.plugins.MyMetrix.Store.SkinPart_Developer.value),
						'restrictions':metrixTools.getRestrictions(),
						'orderby':self.orderby,
						'type':str(self.type)}
			else:
				params = {'screenname':self.screenname,
						'suite_id':self.suite_id,
						'orderby':self.orderby,
						'restrictions':metrixTools.getRestrictions(),
						'developer':str(config.plugins.MyMetrix.Store.SkinPart_Developer.value),
						'pagelength':str(self.pagelength),
						'type':str(self.type),
						'pagenum':'1'}
			data = metrixCore.getWeb(metrixDefaults.URL_GET_SKINPARTS,True,params)
			dom = parseString(data)
			for entry in dom.getElementsByTagName('entry'):
				item_id = str(entry.getAttributeNode('id').nodeValue)
				name = str(entry.getAttributeNode('name').nodeValue)
				author = str(entry.getAttributeNode('author').nodeValue)
				version = str(entry.getAttributeNode('version').nodeValue)
				rating = str(entry.getAttributeNode('rating').nodeValue)
				date = str(entry.getAttributeNode('date').nodeValue)
				item_type = str(entry.getAttributeNode('type').nodeValue)
				screenname = str(entry.getAttributeNode('screenname').nodeValue)
				image_id = str(entry.getAttributeNode('image_id').nodeValue)
				image_token = str(entry.getAttributeNode('image_token').nodeValue)
				total_votes = str(entry.getAttributeNode('total_votes').nodeValue)
				description = str(entry.getAttributeNode('description').nodeValue)
				build = str(entry.getAttributeNode('build').nodeValue)
				image_link = str(entry.getAttributeNode('image_link').nodeValue)
				downloads = str(entry.getAttributeNode('downloads').nodeValue)
				menu.append(self.SkinPartsListEntry(item_id,name,author,rating,date,version,total_votes,item_type,image_id,image_token,description,screenname,image_link,isactive,build))
				metrixTools.callOnMainThread(self.setList,menu)
			if len(menu) < 1:
				self.picPath = metrixDefaults.PLUGIN_DIR + "images/sponsor.png"
				metrixTools.callOnMainThread(self.setList,menu)
		except Exception, e:
			metrixTools.log("Error getting SkinParts", e)
			self.picPath = metrixDefaults.PLUGIN_DIR + "images/sponsor.png"
			metrixTools.callOnMainThread (self.setList,menu)
コード例 #25
0
def widgetActive(path,xmlfile="data.xml",configfile="config.cfg",screenname="InfoBar"):
	xml = ""
	try:
		raw_xml = metrixTools.getFile(path+"/"+xmlfile)
		#Read config file
		skinpartconfig = ConfigParser.RawConfigParser()
		skinpartconfig.read(path+"/"+configfile)
		
		try:
			target = skinpartconfig.get("screen",screenname.lower())
			if target == "" or target == None:
				skinPartNode = False
		except Exception, e:
			metrixTools.log("No config.cfg found in "+path)	
	except Exception, e:
		metrixTools.log("Error parsing SkinPart!",e)
		skinPartNode = None
コード例 #26
0
	def writeFile(self,skindom):
		try:
			self["output"].setText(_("Writing skin file, please wait..."))
			oldfilename = config.plugins.MyMetrix.Templates.value.split("/")[-1]
			file =  config.plugins.MyMetrix.Templates.value.replace(oldfilename,"skin."+config.plugins.MyMetrix.SkinName.value + ".xml")
			path = os.path.dirname(file)	
			if not os.path.exists(path):
				os.makedirs(path)	
			metrix_SkinPartTools.writeSkinFile(skindom,file)
		
			self["output"].setText(_("Activating Skin"))
			config.skin.primary_skin.value = file.replace(metrixDefaults.SKINS_ROOT,"")
			config.skin.primary_skin.save()
			configfile.save()
		except Exception, e:
			
			metrixTools.log("Error activating skin",e)
コード例 #27
0
	def getPackages(self,isactive=""):
		menu = []
		try:
			params = {'restrictions':metrixTools.getRestrictions(),
					  'orderby':self.orderby+" "+self.limit,
					  'category_id':str(self.category_id)}
			data = metrixCore.getWeb(self.url,True,params)
			if "<exception status=""error""" in data:
				raise Exception("Error loading data")
			dom = parseString(data)
			for design in dom.getElementsByTagName('entry'):
				isinstalled = False
				updateavailable = False
				item_id = str(design.getAttributeNode('id').nodeValue)
				name = str(design.getAttributeNode('name').nodeValue)
				author = str(design.getAttributeNode('author').nodeValue)
				version = str(design.getAttributeNode('version').nodeValue)
				rating = str(design.getAttributeNode('rating').nodeValue)
				date = str(design.getAttributeNode('date_created').nodeValue)
				date_modified = str(design.getAttributeNode('date_modified').nodeValue)
				item_type = str(design.getAttributeNode('type').nodeValue)
				file_link = str(design.getAttributeNode('file_link').nodeValue)
				image_link = str(design.getAttributeNode('image_link').nodeValue)
				icon_link = str(design.getAttributeNode('icon_link').nodeValue)
				downloads = str(design.getAttributeNode('downloads').nodeValue)
				total_votes = str(design.getAttributeNode('total_votes').nodeValue)
				build = int(design.getAttributeNode('build').nodeValue)
				description = str(design.getAttributeNode('description').nodeValue)
				previouspackage = str(design.getAttributeNode('previouspackage').nodeValue)
				path = metrixDefaults.pathRoot()+"packages/"+item_id
				localbuild = int(metrixDefaults.cfg(metrixDefaults.CONFIG_INSTALLEDPACKAGES,item_id,"build","int"))
				# add when not only updates or (only updates and online build is higher)
				if not localbuild == metrixDefaults.NONEINT:
					isinstalled = True
				if build > localbuild:
					updateavailable = True
				if (not self.onlyupdates and not self.onlyinstalled == True) or (build > localbuild and self.onlyupdates == True) or (self.onlyinstalled and isinstalled == True):
					menu.append(self.PackagesListEntry(item_id,name,author,rating,date,version,total_votes,item_type,image_link,icon_link,description,file_link,downloads,previouspackage,date_modified,build,isinstalled,updateavailable))
				metrixTools.callOnMainThread(self.setList,menu)
			if len(menu) < 1:
				self.image = metrixDefaults.PLUGIN_DIR + "images/sponsor.png"
				metrixTools.callOnMainThread(self.setList,menu)
		except Exception, e:
			metrixTools.log('Error getting packages via web',e)
			self.image = metrixDefaults.PLUGIN_DIR + "images/sponsor.png"
			metrixTools.callOnMainThread(self.setList,menu)
コード例 #28
0
	def getPackages(self):
		menu = []
		try:
			params = {'restriction-oe':metrixTools.getOERestriction(),
					'restriction-image':metrixTools.getImageRestriction(),
					  'orderby':self.orderby+" "+self.limit,
					  'category_id':str(self.category_id)}
			data = metrixCore.getWeb(self.url,True,params)
			if "<exception status=""error""" in data:
				raise Exception("Error loading data")
			dom = parseString(data)
			for design in dom.getElementsByTagName('entry'):
				isinstalled = False
				updateavailable = False
				item_id = str(design.getAttributeNode('id').nodeValue)
				name = str(design.getAttributeNode('name').nodeValue)
				author = str(design.getAttributeNode('author').nodeValue)
				version = str(design.getAttributeNode('version').nodeValue)
				rating = str(design.getAttributeNode('rating').nodeValue)
				date = str(design.getAttributeNode('date_created').nodeValue)
				date_modified = str(design.getAttributeNode('date_modified').nodeValue)
				item_type = str(design.getAttributeNode('type').nodeValue)
				file_link = str(design.getAttributeNode('file_link').nodeValue)
				image_link = str(design.getAttributeNode('image_link').nodeValue)
				icon_link = str(design.getAttributeNode('icon_link').nodeValue)
				downloads = str(design.getAttributeNode('downloads').nodeValue)
				total_votes = str(design.getAttributeNode('total_votes').nodeValue)
				build = int(design.getAttributeNode('build').nodeValue)
				description = str(design.getAttributeNode('description').nodeValue)
				previouspackage = str(design.getAttributeNode('previouspackage').nodeValue)
				localbuild = int(metrixDefaults.cfg(metrixDefaults.CONFIG_INSTALLEDPACKAGES,item_id,"build","int"))
				# add when not only updates or (only updates and online build is higher)
				if (not localbuild == metrixDefaults.NONEINT) or item_id == config.plugins.MyMetrix.XPiconsRepository.value:
					isinstalled = True
				if build > localbuild:
					updateavailable = True
				if (not self.onlyupdates and not self.onlyinstalled == True) or (build > localbuild and self.onlyupdates == True) or (self.onlyinstalled and isinstalled == True):
					menu.append(self.PackagesListEntry(item_id,name,author,rating,date,version,total_votes,item_type,image_link,icon_link,description,file_link,downloads,previouspackage,date_modified,build,isinstalled,updateavailable))
				metrixTools.callOnMainThread(self.setList,menu)
			if len(menu) < 1:
				self.image = metrixDefaults.PLUGIN_DIR + "images/sponsor.png"
				metrixTools.callOnMainThread(self.setList,menu)
		except Exception, e:
			metrixTools.log('Error getting packages via web',e)
			self.image = metrixDefaults.PLUGIN_DIR + "images/sponsor.png"
			metrixTools.callOnMainThread(self.setList,menu)
コード例 #29
0
def getPackageName(packagePath,packageFile):
	try:
		if os.path.isfile('/tmp/control.tar.gz'):
			os.remove('/tmp/control.tar.gz')
		if os.path.isfile('/tmp/control'):
			os.remove('/tmp/control')
		packageInfo = runCommand('cd '+packagePath+ ' && ar x ./'+packageFile+' control.tar.gz && tar xf ./control.tar.gz ./control && cat control | grep Package')
		os.remove('/tmp/openstore/control.tar.gz')
		os.remove('/tmp/openstore/control')
		if packageInfo[0]:
			packageName = packageInfo[1].split(": ")
			return packageName[1]
		else:
			return ""
	except Exception, e:
		metrixTools.log("Error reading pacakge name",e)
		return ""
コード例 #30
0
    def __init__(self, session):
        self["title"] = Label(_("Welcome to MyMetrix!"))
        self["description"] = Label(
            _("MyMetrix brings your set-top box experience onto a whole new level!\nPress left button to start the easy setup which generates the default MetrixHD feeling. Alternatively press right button to explore great SkinParts in OpenStore and customize your user interface how ever you want!"
              ))
        Screen.__init__(self, session)
        self.session = session
        self["right"] = Label(_("Customize"))
        self["left"] = Label(_("Easy setup"))
        #self["helperimage"].instance.setPixmapFromFile("/usr/lib/enigma2/python/Plugins/Extensions/MyMetrix/images/nopreview.png")

        config.plugins.MyMetrix.showFirstRun.value = False
        config.plugins.MyMetrix.showFirstRun.save()
        try:
            configfile.save()
        except Exception, e:
            metrixTools.log("Error writing config file", e, "MetrixInto")
コード例 #31
0
def GetWeather():
	woeid = config.plugins.MetrixWeather.woeid.value
	metrixTools.log("Lookup for ID " + str(woeid),None,"MetrixWeather")
	url = "http://query.yahooapis.com/v1/public/yql?q=select%20item%20from%20weather.forecast%20where%20woeid%3D%22"+str(woeid)+"%22&format=xml"
	#url = "http://query.yahooapis.com/v1/public/yql?q=select%20item%20from%20weather.forecast%20where%20woeid%3D%22"+str(woeid)+"%22%20u%3Dc&format=xml"
	
	
	# where location in (select id from weather.search where query="oslo, norway")
	file = urllib.urlopen(url)
	data = file.read()
	file.close()
	
	dom = parseString(data)
	title = getTextNode(dom.getElementsByTagName('title')[0].childNodes)
	config.plugins.MetrixWeather.currentLocation.value = str(title).split(',')[0].replace("Conditions for ","")
	
	currentWeather = dom.getElementsByTagName('yweather:condition')[0]
	currentWeatherCode = currentWeather.getAttributeNode('code')
	config.plugins.MetrixWeather.currentWeatherCode.value = ConvertCondition(currentWeatherCode.nodeValue)
	currentWeatherTemp = currentWeather.getAttributeNode('temp')
	config.plugins.MetrixWeather.currentWeatherTemp.value = getTemp(currentWeatherTemp.nodeValue)
	currentWeatherText = currentWeather.getAttributeNode('text')
	config.plugins.MetrixWeather.currentWeatherText.value = currentWeatherText.nodeValue
	
	currentWeather = dom.getElementsByTagName('yweather:forecast')[0]
	currentWeatherCode = currentWeather.getAttributeNode('code')
	config.plugins.MetrixWeather.forecastTodayCode.value = ConvertCondition(currentWeatherCode.nodeValue)
	currentWeatherTemp = currentWeather.getAttributeNode('high')
	config.plugins.MetrixWeather.forecastTodayTempMax.value = getTemp(currentWeatherTemp.nodeValue)
	currentWeatherTemp = currentWeather.getAttributeNode('low')
	config.plugins.MetrixWeather.forecastTodayTempMin.value = getTemp(currentWeatherTemp.nodeValue)
	currentWeatherText = currentWeather.getAttributeNode('text')
	config.plugins.MetrixWeather.forecastTodayText.value = currentWeatherText.nodeValue

	currentWeather = dom.getElementsByTagName('yweather:forecast')[1]
	currentWeatherCode = currentWeather.getAttributeNode('code')
	config.plugins.MetrixWeather.forecastTomorrowCode.value = ConvertCondition(currentWeatherCode.nodeValue)
	currentWeatherTemp = currentWeather.getAttributeNode('high')
	config.plugins.MetrixWeather.forecastTomorrowTempMax.value = getTemp(currentWeatherTemp.nodeValue)
	currentWeatherTemp = currentWeather.getAttributeNode('low')
	config.plugins.MetrixWeather.forecastTomorrowTempMin.value = getTemp(currentWeatherTemp.nodeValue)
	currentWeatherText = currentWeather.getAttributeNode('text')
	config.plugins.MetrixWeather.forecastTomorrowText.value = currentWeatherText.nodeValue
	config.plugins.MetrixWeather.save()
	configfile.save()
コード例 #32
0
def installBundle(id,type="",author=""):
	downloadurl = metrixDefaults.URL_GET_SKINPART_BUNDLE + "&id="+id
	skinparts = str(metrixCore.getWeb(downloadurl,True,{"author":author})).split(";")
	for skinpart in skinparts:
		
		try:
			downloadmetaurl = metrixDefaults.URL_GET_SKINPART_META_UPDATE + "&id="+skinpart
			metafile = metrixCore.getWeb(downloadmetaurl,True)
			dom = parseString(metafile)
			for design in dom.getElementsByTagName('entry'):
				id = str(design.getAttributeNode('id').nodeValue)
				name = str(design.getAttributeNode('name').nodeValue)
				type = str(design.getAttributeNode('type').nodeValue)
				author = str(design.getAttributeNode('author').nodeValue)
				image_link = str(design.getAttributeNode('image_link').nodeValue)
				installSkinPart(skinpart,type,author,image_link)
		except Exception, e:
			metrixTools.log("Error getting SkinParts",e)
コード例 #33
0
ファイル: metrixConnector.py プロジェクト: andgoldi/OpenStore
def syncHourly():
	while(1):
		try:
			metrixWeatherUpdater.GetWeather()
		except Exception, e:
			metrixTools.log("Error downloading weather!",e)
			traceback.print_exc()
		if metrixCore.isLoggedIn():
			try:
				prepareInfo(global_session)
			except:
				traceback.print_exc()
			try:
				if config.plugins.MetrixCloudSync.SyncPackages.value:
					metrix_PackageTools.syncPackages()
			except:
				traceback.print_exc()
		time.sleep(60*60)
コード例 #34
0
ファイル: metrixConnector.py プロジェクト: iMaxxx/OpenStore
def syncHourly():
	while(1):
		try:
			metrixWeatherUpdater.GetWeather()
		except Exception, e:
			metrixTools.log("Error downloading weather!",e)
			traceback.print_exc()
		if metrixCore.isLoggedIn():
			try:
				prepareInfo(global_session)
			except:
				traceback.print_exc()
			try:
				if config.plugins.MetrixCloudSync.SyncPackages.value:
					metrix_PackageTools.syncPackages()
			except:
				traceback.print_exc()
		time.sleep(90*60)
コード例 #35
0
	def downloadSkinPart(self):
		metrixTools.callOnMainThread(self["isInstalled"].setText,"Installing...")
		try:
			id = self.currentid
			type = self.currenttype
			author = self.currentauthor
			type = str(self["menu"].l.getCurrentSelection()[0][7])
			image_link = str(self["menu"].l.getCurrentSelection()[0][13])
			if type == "bundle":
				metrix_SkinPartTools.installBundle(id)
			else:
				metrix_SkinPartTools.installSkinPart(id,type,author,image_link)
			getCatalog = True
			getEntry = True
			metrixTools.callOnMainThread(self["isInstalled"].setText,"Installation successful!")
		except Exception, e:
			metrixTools.log("Error installing SkinPart "+id,e)
			metrixTools.callOnMainThread(self["isInstalled"].setText,"Error during installation!")
コード例 #36
0
def downloadAdditionalFiles(url,target_path,searchpattern="",replacepattern="",forceOverwrite = True,urlparameters=""):
	try:
		data = metrixCore.getWeb(url,True)
		#print(data)
		
		dom = parseString(data)
		
		for file in dom.getElementsByTagName('entry'):
			url = str(file.getAttributeNode('url').nodeValue)+urlparameters
			file_name = str(file.getAttributeNode('url').nodeValue).split('file=')[-1]
			if not os.path.exists(target_path):
				os.makedirs(target_path)
			if metrixTools.downloadFile(url,target_path+file_name,searchpattern,replacepattern,forceOverwrite) == None:
				return False
				metrixTools.log("Error downloading file!")
		return True
	except Exception, e:
		metrixTools.log("No additional files available!",e)
		return False
コード例 #37
0
def uninstallPackage(packageName,id=0,silent=False):
	metrixTools.log("Uninstalling package "+packageName,None,"OpenStore")
	cmdStatus = runCommand("opkg remove '"+packageName+"'")
	if cmdStatus[0] == True: #Command without errorcode
		config.plugins.MetrixUpdater.Reboot.value = 1
		config.plugins.MetrixUpdater.save()    
		configfile.save()
		if not id == 0:
			metrixDefaults.cfgremovesection(metrixDefaults.CONFIG_INSTALLEDPACKAGES,id)
		if not silent:
			metrixConnector.showInfo(cmdStatus[1])
		else:
			return True
	else:
		if not silent:
			metrixConnector.showInfo(_("Error uninstalling Package!"),MessageBox.TYPE_ERROR)
		else:
			return False
	syncPackages()
コード例 #38
0
 def getDesigns(self):
     menu = []
     try:
         data = metrixCore.getWeb(metrixDefaults.URL_GET_METRIXCOLORS, True, {"name": self.currentname})
         # print data
         dom = parseString(data)
         for design in dom.getElementsByTagName("design"):
             name = str(design.getAttributeNode("name").nodeValue)
             title = str(design.getAttributeNode("title").nodeValue)
             author = str(design.getAttributeNode("author").nodeValue)
             rating = str(design.getAttributeNode("rating").nodeValue)
             date = str(design.getAttributeNode("date").nodeValue)
             total_votes = str(design.getAttributeNode("total_votes").nodeValue)
             menu.append(self.DesignsListEntry(name, title, author, rating, date, total_votes))
             metrixTools.callOnMainThread(self.setList, menu)
     except Exception, e:
         metrixTools.log("Error getting MetrixColor via web!", e)
         menu.append(self.DesignsListEntry("-", _("Error loading data!")))
         metrixTools.callOnMainThread(self.setList, menu)
コード例 #39
0
ファイル: metrixConnector.py プロジェクト: iMaxxx/OpenStore
def installPackage(param,actionId,isUpdate=False):
	params = param.split(";")
	packageId = params[0]
	metrixTools.log("Installing package "+packageId)
	downloadurl = metrixDefaults.URL_STORE_API + "get.xml.packagefile&file_id="+params[1]+"&token="+params[2]
	if isUpdate:
		downloadurl = metrixDefaults.URL_STORE_API + "get.xml.packagefile-update&file_id="+params[1]+"&token="+params[2]
	localPath = "/tmp/metrixPackage.ipk"
	instSuccess = metrix_PackageTools.installPackage(downloadurl,True)
	if instSuccess:
		config.plugins.MetrixUpdater.Reboot.value = 1
		config.plugins.MetrixUpdater.save()    
		configfile.save()
		path = metrixDefaults.pathRoot()+"packages/"+packageId
		if not os.path.exists(path):
			os.makedirs(path)
		showInfo(_("Package successfully installed!"))
	else:
		showInfo(_("Error installing package!"),MessageBox.TYPE_ERROR)
		metrixTools.log("Error installing package "+params[0])
コード例 #40
0
def widgetActive(path,
                 xmlfile="data.xml",
                 configfile="config.cfg",
                 screenname="InfoBar"):
    xml = ""
    try:
        raw_xml = metrixTools.getFile(path + "/" + xmlfile)
        #Read config file
        skinpartconfig = ConfigParser.RawConfigParser()
        skinpartconfig.read(path + "/" + configfile)

        try:
            target = skinpartconfig.get("screen", screenname.lower())
            if target == "" or target == None:
                skinPartNode = False
        except Exception, e:
            metrixTools.log("No config.cfg found in " + path)
    except Exception, e:
        metrixTools.log("Error parsing SkinPart!", e)
        skinPartNode = None
コード例 #41
0
	def disconnectDevice(self):
		try:
			url = metrixDefaults.URL_STORE_API + 'connect.deletedevice'
			data = metrixCore.getWeb(url,True)
			if not data:
				metrixTools.log("Error connecting to server!")
			
			dom = parseString(data)
			for design in dom.getElementsByTagName('entry'):
				status = str(design.getAttributeNode('status').nodeValue)
			if status == 'success':
				config.plugins.MetrixConnect.PIN.value = 0
				config.plugins.MetrixConnect.username.value = "Not connected"
				config.plugins.MetrixConnect.auth_token.value = "None"
				config.plugins.MetrixConnect.auth_id.value = ""
				config.plugins.MetrixConnect.save()
				configfile.save()
				self.close()
		except Exception, e:
			metrixTools.log("Error disconnecting device",e)
コード例 #42
0
def installBundle(id, type="", author=""):
    downloadurl = metrixDefaults.URL_GET_SKINPART_BUNDLE + "&id=" + id
    skinparts = str(metrixCore.getWeb(downloadurl, True,
                                      {"author": author})).split(";")
    for skinpart in skinparts:

        try:
            downloadmetaurl = metrixDefaults.URL_GET_SKINPART_META_UPDATE + "&id=" + skinpart
            metafile = metrixCore.getWeb(downloadmetaurl, True)
            dom = parseString(metafile)
            for design in dom.getElementsByTagName('entry'):
                id = str(design.getAttributeNode('id').nodeValue)
                name = str(design.getAttributeNode('name').nodeValue)
                type = str(design.getAttributeNode('type').nodeValue)
                author = str(design.getAttributeNode('author').nodeValue)
                image_link = str(
                    design.getAttributeNode('image_link').nodeValue)
                installSkinPart(skinpart, type, author, image_link)
        except Exception, e:
            metrixTools.log("Error getting SkinParts", e)
コード例 #43
0
ファイル: metrixConnector.py プロジェクト: andgoldi/OpenStore
def installPackage(param,actionId,isUpdate=False):
	params = param.split(";")
	packageId = params[0]
	metrixTools.log("Installing package "+packageId)
	downloadurl = metrixDefaults.URL_STORE_API + "get.xml.packagefile&file_id="+params[1]+"&token="+params[2]
	if isUpdate:
		downloadurl = metrixDefaults.URL_STORE_API + "get.xml.packagefile-update&file_id="+params[1]+"&token="+params[2]
	localPath = "/tmp/metrixPackage.ipk"
	instSuccess = metrix_PackageTools.installPackage(downloadurl,True)
	if instSuccess:
		config.plugins.MetrixUpdater.Reboot.value = 1
		config.plugins.MetrixUpdater.save()    
		configfile.save()
		path = metrixDefaults.pathRoot()+"packages/"+packageId
		if not os.path.exists(path):
			os.makedirs(path)
		showInfo(_("Package successfully installed!"))
	else:
		showInfo(_("Error installing package!"),MessageBox.TYPE_ERROR)
		metrixTools.log("Error installing package "+params[0])
コード例 #44
0
	def getCategories(self):
		list = [[],[],[],[],[]]
		selectionEnabled = False
		i = 1

		list[i].append(self.CategoryEntry(i,"%", _("Installed"), "/img/categories/installed.png",onlyinstalled=True,orderby="date_modified desc",))
		metrixTools.callOnMainThread(self.setList,list[i],i)
		i += 1
		list[i].append(self.CategoryEntry(i,"%", _("Updates"), "/img/categories/updates.png",onlyupdates=True,orderby="date_modified desc",))
		metrixTools.callOnMainThread(self.setList,list[i],i)
		i += 1
		list[i].append(self.CategoryEntry(i,"%", _("New"), "/img/categories/new.png",orderby="date_created desc", limit="LIMIT 20"))
		metrixTools.callOnMainThread(self.setList,list[i],i)
		i += 1
		list[i].append(self.CategoryEntry(i,"%", _("Last Modified"), "/img/categories/recent.png",orderby="date_modified desc", limit="LIMIT 20"))
		metrixTools.callOnMainThread(self.setList,list[i],i)
		i = 1
		list[i].append(self.CategoryEntry(i,"%%", _("Top 50 Downloads"), "/img/categories/top50.png",orderby="rating desc", limit="LIMIT 50"))
		metrixTools.callOnMainThread(self.setList,list[i],i)
		i += 1
		if config.plugins.MyMetrix.Store.Plugin_Developer.value:
			list[i].append(self.CategoryEntry(i,9999, _("My Packages"), "/img/categories/my.png",orderby="date_modified desc",))
			metrixTools.callOnMainThread(self.setList,list[i],i)
			i += 1
		try:
			data = metrixCore.getWeb(metrixDefaults.URL_GET_CATEGORIES,True)
			dom = parseString(data)
			
			for entry in dom.getElementsByTagName('entry'):
				item_id = str(entry.getAttributeNode('id').nodeValue)
				name = str(entry.getAttributeNode('name').nodeValue)
				image_link = str(entry.getAttributeNode('image').nodeValue)
				list[i].append(self.CategoryEntry(i,item_id, name, image_link,orderby="date_created desc"))
				metrixTools.callOnMainThread(self.setList,list[i],i)
				i += 1
				if i == self.columns+1:
					i = 1
			metrixTools.callOnMainThread(self.setMaxRows,len(list[1])+1)
		except Exception,e:
			showInfo("Check your internet connection")
			metrixTools.log("Error getting categories via web!",e)
コード例 #45
0
	def generateSkin(self):
		screennames = [] 
		screennames = self.getSkinPartsScreennames(config.plugins.MyMetrix.SkinPartPath.value + "screens/active/")
		metrixTools.callOnMainThread(self["output"].setText,_("Reading template file"))
		skindom = parse(config.plugins.MyMetrix.Templates.value)
		skinNode = skindom.getElementsByTagName('skin')[0]
		
		metrixTools.callOnMainThread(self["output"].setText,_("Setting colors"))
		self.setColor(skinNode)
		for screen in skinNode.getElementsByTagName('screen'):
			screenname = str(screen.getAttributeNode('name').nodeValue)
			
			metrixTools.callOnMainThread(self["output"].setText,(str(_("Checking screen ")+screenname)))
			if screenname in screennames:
				metrixTools.callOnMainThread(self["output"].setText,_(str("Removing default screen "+screenname)))
				parentNode = screen.parentNode
				parentNode.removeChild(screen)
			if config.plugins.MyMetrix.CleanInfoBar.value:
				if screenname in ["InfoBar","SecondInfoBar","Nab_ExtraInfobar"]:
					ib = skindom.createElement("screen")
					ib.setAttribute('backgroundColor', 'transparent')
					ib.setAttribute('flags', 'wfNoBorder')
					ib.setAttribute('name', screenname)
					ib.setAttribute('position', '0,0')
					ib.setAttribute('size', '1280,720')
					ib.setAttribute('title', "InfoBar")
					skinNode.appendChild(ib)
					print "############################ append "+screenname
				
				
		# APPEND STORE SCREENS
		path = config.plugins.MyMetrix.SkinPartPath.value + "screens/active/"
		dirs = listdir(path)
		for dir in dirs:
			metrixTools.callOnMainThread(self["output"].setText,_("Parsing SkinPart Screens"))
			try:	
				screen = metrix_SkinPartTools.parseSkinPart(path+dir,"data.xml","config.cfg",screenname)
				customscreen = skindom.importNode(screen, True)
				skinNode.appendChild(customscreen)
			except Exception, e:
				metrixTools.log("Error appending screen",e)
コード例 #46
0
    def writeFile(self, skindom):
        try:
            self["output"].setText(_("Writing skin file, please wait..."))
            oldfilename = config.plugins.MyMetrix.Templates.value.split(
                "/")[-1]
            file = config.plugins.MyMetrix.Templates.value.replace(
                oldfilename,
                "skin." + config.plugins.MyMetrix.SkinName.value + ".xml")
            path = os.path.dirname(file)
            if not os.path.exists(path):
                os.makedirs(path)
            metrix_SkinPartTools.writeSkinFile(skindom, file)

            self["output"].setText(_("Activating Skin"))
            config.skin.primary_skin.value = file.replace(
                metrixDefaults.SKINS_ROOT, "")
            config.skin.primary_skin.save()
            configfile.save()
        except Exception, e:

            metrixTools.log("Error activating skin", e)
コード例 #47
0
	def submit(self):
		#&group=DesignStore_dark-red_Test&vote_id=1&device_id=99099&value=2
		try:
			params = {'group':self.group,'vote_id':self.vote_id,'value':self.rating}
			data = metrixCore.getWeb(self.ratingurl,True,params)
			if not data:
				metrixTools.log("Error contacting server")
			
			dom = parseString(data)
			for design in dom.getElementsByTagName('entry'):
				status = str(design.getAttributeNode('status').nodeValue)
				code = str(design.getAttributeNode('code').nodeValue)
			if status == 'error':
				if code == '103':
					self.showInfo("Already voted!")
			else:
				self.showInfo("Thank you!")
			self.close()
		except:
			metrixTools.log("Error submitting rating")
			self.close()
コード例 #48
0
 def downloadSkinPart(self):
     metrixTools.callOnMainThread(self["isInstalled"].setText,
                                  "Installing...")
     try:
         id = self.currentid
         type = self.currenttype
         author = self.currentauthor
         type = str(self["menu"].l.getCurrentSelection()[0][7])
         image_link = str(self["menu"].l.getCurrentSelection()[0][13])
         if type == "bundle":
             metrix_SkinPartTools.installBundle(id)
         else:
             metrix_SkinPartTools.installSkinPart(id, type, author,
                                                  image_link)
         getCatalog = True
         getEntry = True
         metrixTools.callOnMainThread(self["isInstalled"].setText,
                                      "Installation successful!")
     except Exception, e:
         metrixTools.log("Error installing SkinPart " + id, e)
         metrixTools.callOnMainThread(self["isInstalled"].setText,
                                      "Error during installation!")
コード例 #49
0
def isUpdateAvailable(id, local_build):
    try:
        downloadmetaurl = metrixDefaults.URL_GET_SKINPART_META_UPDATE + "&id=" + id
        metafile = metrixCore.getWeb(downloadmetaurl, True)
        dom = parseString(metafile)
        store_date_modified = ""
        for skinpart in dom.getElementsByTagName('entry'):
            try:
                store_build = str(skinpart.getAttributeNode('build').nodeValue)
            except:
                store_build = local_build
            version = str(skinpart.getAttributeNode('version').nodeValue)
        metrixTools.log("Local build: " + local_build + " store build: " +
                        store_build)
        if store_build > local_build:
            return True
        else:
            return False
    except Exception, e:
        return False
        metrixTools.log("Error checking SkinPart updates!", e)
        traceback.print_exc()
コード例 #50
0
 def getDesigns(self):
     menu = []
     try:
         data = metrixCore.getWeb(metrixDefaults.URL_GET_METRIXCOLORS, True,
                                  {'name': self.currentname})
         #print data
         dom = parseString(data)
         for design in dom.getElementsByTagName('design'):
             name = str(design.getAttributeNode('name').nodeValue)
             title = str(design.getAttributeNode('title').nodeValue)
             author = str(design.getAttributeNode('author').nodeValue)
             rating = str(design.getAttributeNode('rating').nodeValue)
             date = str(design.getAttributeNode('date').nodeValue)
             total_votes = str(
                 design.getAttributeNode('total_votes').nodeValue)
             menu.append(
                 self.DesignsListEntry(name, title, author, rating, date,
                                       total_votes))
             metrixTools.callOnMainThread(self.setList, menu)
     except Exception, e:
         metrixTools.log("Error getting MetrixColor via web!", e)
         menu.append(self.DesignsListEntry("-", _("Error loading data!")))
         metrixTools.callOnMainThread(self.setList, menu)
コード例 #51
0
 def getCategories(self):
     menu = []
     menu.append(self.CategoryListEntry(_("Loading...")))
     metrixTools.callOnMainThread(self.setList, menu)
     try:
         data = metrixCore.getWeb(self.url, True)
         dom = parseString(data)
         menu = []
         ## ADD STATIC PSEUDO CATEGORIES
         menu.append(self.CategoryListEntry(_("Skins"), "Skins", "skins"))
         menu.append(
             self.CategoryListEntry(_("MetrixColors"), "MetrixColors",
                                    "brush"))
         menu.append(
             self.CategoryListEntry(_("Newest SkinParts"), "newest", "new"))
         menu.append(
             self.CategoryListEntry(_("Last Modified"), "modified",
                                    "recent"))
         menu.append(
             self.CategoryListEntry(_("Top 50 Downloads"), "mostdownloaded",
                                    "download"))
         menu.append(
             self.CategoryListEntry(_("Skin Extensions"), "Extensions",
                                    "extensions"))
         menu.append(
             self.CategoryListEntry(_("Bundles"), "bundle", "bundle"))
         metrixTools.callOnMainThread(self.setList, menu)
         for entry in dom.getElementsByTagName('entry'):
             item_id = str(entry.getAttributeNode('id').nodeValue)
             name = str(entry.getAttributeNode('name').nodeValue)
             menu.append(self.CategoryListEntry(name, item_id))
             metrixTools.callOnMainThread(self.setList, menu)
     except Exception, e:
         metrixTools.log("Error getting items via web", e)
         menu.append(
             self.CategoryListEntry(_("Error loading data!"), "-", "-"))
         metrixTools.callOnMainThread(self.setList, menu)
コード例 #52
0
ファイル: store_Updater.py プロジェクト: iMaxxx/OpenStore
def getUpdatedFiles():
	metrixTools.log("Searching update for build "+metrixDefaults.BUILD+ "...")
	data = metrixCore.getWeb(metrixDefaults.URL_GET_UPDATE_FILES,True)
	dom = parseString(data)
	for update in dom.getElementsByTagName('update'):
		build = str(update.getAttributeNode('build').nodeValue)
		metrixTools.log("Lastest release: build "+build)
		if build > metrixDefaults.BUILD:
			for files in update.getElementsByTagName('file'):
				update = False
				path = str(files.getAttributeNode('path').nodeValue)
				url = str(files.getAttributeNode('url').nodeValue)
				date_modified = int(files.getAttributeNode('date_modified').nodeValue)
				if not fileExists(path):
					update = True
				else:
					if int(date_modified) > int(os.path.getmtime(path)):
						update = True
				if update:
					metrixTools.downloadFile(url,path,forceOverwrite=True)
					config.plugins.MetrixUpdater.RebootRequired.value = True
					config.plugins.MetrixUpdater.UpdatePopup_Self.value = True
	metrixTools.downloadFile(metrixDefaults.URL_IMAGE_LOADING,metrixDefaults.URI_IMAGE_LOADING,forceOverwrite = True)
	metrixTools.downloadFile(metrixDefaults.URL_IMAGE_SPONSOR,metrixDefaults.URI_IMAGE_SPONSOR,forceOverwrite = True)
コード例 #53
0
ファイル: metrixConnector.py プロジェクト: iMaxxx/OpenStore
def showInfo(text,msg_type=MessageBox.TYPE_INFO):
	try:
		metrixTools.callOnMainThread(Notifications.AddNotification,MessageBox, _(text), type=msg_type,timeout=3)
	except Exception, e:
		metrixTools.log("Error",e)