当前位置: 首页>>代码示例>>Python>>正文


Python ServiceList.setRoot方法代码示例

本文整理汇总了Python中Components.Sources.ServiceList.ServiceList.setRoot方法的典型用法代码示例。如果您正苦于以下问题:Python ServiceList.setRoot方法的具体用法?Python ServiceList.setRoot怎么用?Python ServiceList.setRoot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Components.Sources.ServiceList.ServiceList的用法示例。


在下文中一共展示了ServiceList.setRoot方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: getPicons

# 需要导入模块: from Components.Sources.ServiceList import ServiceList [as 别名]
# 或者: from Components.Sources.ServiceList.ServiceList import setRoot [as 别名]
	def getPicons(self):
		from Components.Sources.ServiceList import ServiceList
		from enigma import eServiceReference, eServiceCenter, iServiceInformation
		import shutil

		currentServiceRef = self.session.nav.getCurrentlyPlayingServiceReference()
		servicelist = ServiceList("")
		servicelist.setRoot(currentServiceRef)
		canais = servicelist.getServicesAsList()

		servicehandler = eServiceCenter.getInstance()

		try:
			os.makedirs("/tmp/piconsTmp")
		except OSError as exception:
			pass

		piconsDir=config.plugins.geradorpicon.pasta.value

		for item in canais:
		    canal = eServiceReference(item[0])
		    if canal:
			    nome = servicehandler.info(canal).getName(canal)
			    picon=canal.toString()[:-1].replace(":","_")+".png"
			    try:
			        shutil.copy(piconsDir+"/"+picon,"/tmp/piconsTmp/"+nome+".png")
			    except:
			        pass
开发者ID:gravatasufoca,项目名称:GeradorPicons,代码行数:30,代码来源:geradorpicons.py

示例2: escreveRefresh

# 需要导入模块: from Components.Sources.ServiceList import ServiceList [as 别名]
# 或者: from Components.Sources.ServiceList.ServiceList import setRoot [as 别名]
	def escreveRefresh(self):
		from enigma import eServiceReference, eServiceCenter, iServiceInformation
		from Components.Sources.ServiceList import ServiceList
		import re


		currentServiceRef = self.session.nav.getCurrentlyPlayingServiceReference()

		servicelist = ServiceList("")
		servicelist.setRoot(currentServiceRef)

		canais = servicelist.getServicesAsList()

		servicehandler = eServiceCenter.getInstance()
		tmpCanais={}
		for item in canais:
			canal = eServiceReference(item[0])
			if canal:
			    nome = servicehandler.info(canal).getName(canal)
			    tipo=item[0].split(":")[2]
			    if tipo=="2": continue

			    transponder_info = servicehandler.info(canal).getInfoObject(canal, iServiceInformation.sTransponderData)
			    id=str(transponder_info["frequency"])

			    if transponder_info["tuner_type"]!="DVB-C":
				    id=id+str(transponder_info["polarization"])
				    position=transponder_info["orbital_position"]
			    else:
				    position="DVB-C"
				    id=id+str(transponder_info["symbol_rate"])


			    if(position==config.plugins.Easy.pref.value):
				    if not tmpCanais.has_key(id):
						tmpCanais[id]="#SERVICE %s:%s"%(item[0],nome)

		arq_name="%s/bouquets.tv"%(utils.outdir)
		arq = open(arq_name, "r+")
		check=False
		for linha in arq.readlines():
			if "userbouquet.refresh.tv" in linha:
				check=True
		if not check:
			arq.write("#SERVICE 1:7:1:0:0:0:0:0:0:0:FROM BOUQUET \"userbouquet.refresh.tv\" ORDER BY bouquet\n")
		arq.close()

		arq_name="%s/userbouquet.refresh.tv"%(utils.outdir)
		arq = open(arq_name, "w")
		arq.write("#NAME epgrefresh\n")

		for canal in tmpCanais:
			arq.write(tmpCanais[canal]+"\n")

		arq.close()
开发者ID:gravatasufoca,项目名称:EasyBouquets,代码行数:57,代码来源:easybouquets.py

示例3: escreveCanais

# 需要导入模块: from Components.Sources.ServiceList import ServiceList [as 别名]
# 或者: from Components.Sources.ServiceList.ServiceList import setRoot [as 别名]
	def escreveCanais(self):
		from enigma import eServiceReference, eServiceCenter, iServiceInformation
		from Components.Sources.ServiceList import ServiceList
		import re


		t=open("/tmp/canais.csv","w")

		currentServiceRef = self.session.nav.getCurrentlyPlayingServiceReference()

		servicelist = ServiceList("")
		servicelist.setRoot(currentServiceRef)

		canais = servicelist.getServicesAsList()

		servicehandler = eServiceCenter.getInstance()
		from sets import Set
		ctmp=Set()
		for item in canais:
		    canal = eServiceReference(item[0])
		    if canal:
			    nome = servicehandler.info(canal).getName(canal)

			    if nome=="(...)" or re.match("\d+",nome): continue
			    tipo=item[0].split(":")[2]
			    if tipo=="2": continue

			    transponder_info = servicehandler.info(canal).getInfoObject(canal, iServiceInformation.sTransponderData)

			    if transponder_info["tuner_type"]=="DVB-C":
				    continue

			    position = int(transponder_info["orbital_position"])

			    if(position==config.plugins.Easy.pref.value):
				    ctmp.add("%s,%s\n"%(nome.strip(),"True" if tipo in ["19","25"] else "False"))


		for c in ctmp:
			t.write(c)
开发者ID:gravatasufoca,项目名称:EasyBouquets,代码行数:42,代码来源:easybouquets.py

示例4: WAPfunctions

# 需要导入模块: from Components.Sources.ServiceList import ServiceList [as 别名]
# 或者: from Components.Sources.ServiceList.ServiceList import setRoot [as 别名]

#.........这里部分代码省略.........
		if repeated >= 4:
			repeated = repeated - 4
			we.append("checked")
		else:
			we.append("")

		if repeated >= 2:
			repeated = repeated - 2
			tu.append("checked")
		else:
			tu.append("")

		if repeated == 1:
			repeated = repeated - 1
			mo.append("checked")
		else:
			mo.append("")

		return [
			mo,
			tu,
			we,
			th,
			fr,
			sa,
			su,
			mf,
			ms,
		]

	def serviceListOne(self, bouquet, selref):
		ref = eServiceReference(bouquet)
		self.servicelist = ServiceList(ref, command_func=self.getServiceList, validate_commands=False)
		self.servicelist.setRoot(ref)
		returnList = []
		for (ref2, name) in self.servicelist.getServicesAsList():
			print "ref2: (", ref2, ") name: (", name, ")"
			returnListPart = [
				name,
				ref2
			]
			if ref2 == str(selref):
				returnListPart.append("selected")
				self.sRefFound = 1
			else:
				returnListPart.append("")
			returnList.append(returnListPart)
		return returnList

	def serviceList(self, param):
		print "serviceList: ", param
		sRef = str(param["sRef"])
		bouquet = str(param["bouquet"])
		self.sRefFound = 0

		if bouquet == '':
			returnList = []
			bouquet = '1:7:1:0:0:0:0:0:0:0:FROM BOUQUET "bouquets.tv" ORDER BY bouquet'
			ref = eServiceReference(bouquet)
			self.servicelist = ServiceList(ref, command_func=self.getServiceList, validate_commands=False)
			self.servicelist.setRoot(ref)
			for (ref2, name) in self.servicelist.getServicesAsList():
				part = self.serviceListOne(ref2, sRef)
				if part:
					returnList = returnList + [["-- " + name + " --", "<" + name + ">", ""]] + part
			bouquet = '1:7:1:0:0:0:0:0:0:0:FROM BOUQUET "bouquets.radio" ORDER BY bouquet'
开发者ID:4doe,项目名称:e2plugins,代码行数:70,代码来源:WAPfunctions.py

示例5: ServiceListRecursive

# 需要导入模块: from Components.Sources.ServiceList import ServiceList [as 别名]
# 或者: from Components.Sources.ServiceList.ServiceList import setRoot [as 别名]
class ServiceListRecursive(Source):
	FETCH = 0

	def __init__(self, session, func=FETCH):
		Source.__init__(self)

		self.session = session
		self.func = func
		self.servicelist = {}
		self.xml = ""
		self.command = eServiceReference(service_types_tv + ' FROM BOUQUET "bouquets.tv" ORDER BY bouquet')

	def handleCommand(self, cmd):
		self.command = eServiceReference(cmd)

	def do_func(self):
		if self.func == self.FETCH:
			func = self.buildList
		else:
			func = self.buildList

		return func(self.command)

	def buildList(self, ref):
		self.servicelist = ServiceList(ref, command_func=self.getServiceList, validate_commands=False)
		list = self.servicelist.getServicesAsList()
		for item in list:
			self.servicelist.setRoot(eServiceReference(item[0]))
			sub = self.servicelist.getServicesAsList()

			if sub:
				self.xml += "\t<e2bouquet>\n"
				bouquet = True

				subxml = ""
				for (ref, name) in sub:
					subxml += "\t\t\t<e2service>\n"
					subxml += "\t\t\t\t<e2servicereference>%s</e2servicereference>\n\t\t\t\t<e2servicename>%s</e2servicename>\n" % (self.filterXML(ref), self.filterXML(name))
					subxml += "\t\t\t</e2service>\n"

			else:
				self.xml += "\t\t<e2service>\n"
				bouquet = False

			self.xml += "\t\t<e2servicereference>%s</e2servicereference>\n\t\t<e2servicename>%s</e2servicename>\n" % (self.filterXML(item[0]), self.filterXML(item[1]))

			if bouquet:
				self.xml += "\t\t<e2servicelist>\n"
				self.xml += subxml
				self.xml += "\t\t</e2servicelist>\n"
				self.xml += "\t</e2bouquet>\n"
			else:
				self.xml += "\t</e2service>\n"

		return self.xml

	def filterXML(self, item):
		item = item.replace("&", "&amp;").replace("<", "&lt;").replace('"', '&quot;').replace(">", "&gt;")
		return item

	def getServiceList(self, ref):
		self.servicelist.root = ref

	text = property(do_func)
开发者ID:TitanNit,项目名称:tdt,代码行数:66,代码来源:ServiceListRecursive.py

示例6: gerarBouquets

# 需要导入模块: from Components.Sources.ServiceList import ServiceList [as 别名]
# 或者: from Components.Sources.ServiceList.ServiceList import setRoot [as 别名]
    def gerarBouquets(self):
            self.mudaSituacao(1, _("Creating favorites"))

            from enigma import eServiceReference, eServiceCenter, iServiceInformation
            from Components.Sources.ServiceList import ServiceList

            if self.parserules():

                self.satPref=config.plugins.Easy.pref.value if config.plugins.Easy.pref.value=="DVB-C" else utils.positionToSat(config.plugins.Easy.pref.value)

                currentServiceRef = self.session.nav.getCurrentlyPlayingServiceReference()
                servicelist = ServiceList("")
                servicelist.setRoot(currentServiceRef)
                try:
                    canais = servicelist.getServicesAsList()
                except:
	                self.session.open(MessageBox, text = _("Please, put in valid service first."), type = MessageBox.TYPE_WARNING,close_on_any_key=True, timeout=5)
	                return
#                tmp=open("/tmp/teste","w")
                servicehandler = eServiceCenter.getInstance()
                for item in canais:
                    canal = eServiceReference(item[0])
                    if canal:

                        nome = servicehandler.info(canal).getName(canal)

                        if nome=="(...)" or re.match("\d+",nome): continue
                        # tipo=str(canal.type)

                        tipo=item[0].split(":")[2]

                        transponder_info = servicehandler.info(canal).getInfoObject(canal, iServiceInformation.sTransponderData)

                        cabo = True if transponder_info["tuner_type"]=="DVB-C" else False

                        if cabo and nome.strip().lower().endswith("hd"):
                            tipo="25"

                        if str(tipo) in ["1","19","25"]:
                            if transponder_info["tuner_type"]=="DVB-C":
                                satName="DVB-C"
                                sat=satName
                                position=satName
                            else:
                                position = int(transponder_info["orbital_position"])

                                if position>1800:
                                    sat= str(int(((float(position)/10)-360)*10))
                                    satName= "%sW" % str(int(((float(position)/10)-360)*-1))
                                else:
                                    sat= str(int(((float(position)/10)+180)*10))
                                    satName= "%sE" % str(int(((float(position)/10)-180)*-1))


                            frequencia=str(int(transponder_info["frequency"])/1000)

                            sid = canal.toString().split(":")[3]
                            sid=str(int(sid,16))
                            #                                tmp.write("%s:%s\n"%(nome,sid))
                            bouqs=self.whichBouquets(nome,sat,frequencia,sid,tipo)
                            for bq in bouqs:
                                if config.plugins.Easy.addSat.value:
                                    self.bouquets[bq].append("%s:%s (%s)"%(item[0],nome,satName))
                                else:
                                    self.bouquets[bq].append("%s:%s"%(item[0],nome))

                            if not self.fazParte(nome, self.rulesdict["exclude"], sat, frequencia,sid,tipo):
                                tmpCanal=self.fazParteFavorito(nome, sat, frequencia,sid,tipo)
                                if tmpCanal:
                                    if config.plugins.Easy.addSat.value:
                                        self.favouritesTv.append("%s:%s (%s)"%(item[0],nome,satName))
                                    else:
                                        self.favouritesTv.append("%s:%s"%(item[0],nome))

                        elif tipo=="2":
                            if(position==config.plugins.Easy.pref.value):
                                self.favouritesRadio.append("%s:%s"%(item[0],nome))

                    if config.plugins.Easy.operadora.value and position==config.plugins.Easy.pref.value:
                        self.favoritoOperadora.append("%s:%s"%(item[0],nome))

                self.mudaSituacao(40, _("Deleting all favorites"))

                self.t=eTimer()
                self.t.callback.append(utils.removeoldfiles)
                self.t.callback.append(self.escreveBouquets)
                if config.plugins.Easy.operadora.value:
                    self.t.callback.append(self.escreveOperadoraFavoritos)

                self.t.start(1,True)

                return True
            else:
                self.iniciar.stop()
                self.close()
                return False
开发者ID:gravatasufoca,项目名称:EasyBouquets,代码行数:98,代码来源:loading.py


注:本文中的Components.Sources.ServiceList.ServiceList.setRoot方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。