Exemplo n.º 1
0
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)
Exemplo n.º 2
0
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)
Exemplo n.º 3
0
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)
Exemplo n.º 4
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)
Exemplo n.º 5
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)
Exemplo n.º 6
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)
Exemplo n.º 7
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)
Exemplo n.º 8
0
	def removePackage(self):
		isinstalled = self["menu"].l.getCurrentSelection()[0][15]
		if isinstalled:
			self.updatestatus(_("Removing..."))
			packageName = metrixDefaults.cfg(metrixDefaults.CONFIG_INSTALLEDPACKAGES,self.currentid,"name")
			if not packageName == "":
				if metrix_PackageTools.uninstallPackage(packageName,id=self.currentid,silent=True):
					self.updatestatus(_("Successfully removed!"))
					time.sleep(2)
					self.getCatalog = True
					self.getEntry = True
				else:
					self.updatestatus(_("Error removing package!"))
			else:
				metrixDefaults.cfgremovesection(metrixDefaults.CONFIG_INSTALLEDPACKAGES,id)
				self.updatestatus(_("Entry removed!"))
				time.sleep(2)
				self.getCatalog = True
				self.getEntry = True
Exemplo n.º 9
0
	def removePackage(self):
		isinstalled = self["menu"].l.getCurrentSelection()[0][15]
		if isinstalled:
			self.updatestatus(_("Removing..."))
			packageName = metrixDefaults.cfg(metrixDefaults.CONFIG_INSTALLEDPACKAGES,self.currentid,"name")
			if not packageName == "":
				if metrix_PackageTools.uninstallPackage(packageName,id=self.currentid,silent=True):
					self.updatestatus(_("Successfully removed!"))
					time.sleep(2)
					self.getCatalog = True
					self.getEntry = True
				else:
					self.updatestatus(_("Error removing package!"))
			else:
				metrixDefaults.cfgremovesection(metrixDefaults.CONFIG_INSTALLEDPACKAGES,id)
				self.updatestatus(_("Entry removed!"))
				time.sleep(2)
				self.getCatalog = True
				self.getEntry = True