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


Python ServiceList.ServiceList类代码示例

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


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

示例1: serviceList

	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'
			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
		else:
			returnList = self.serviceListOne(bouquet, sRef)

		if self.sRefFound == 0 and sRef != '':
			returnListPart = ["Inserted", sRef, "selected"]
			returnList = [returnListPart] + returnList
		#print returnList
		return returnList
开发者ID:4doe,项目名称:e2plugins,代码行数:32,代码来源:WAPfunctions.py

示例2: getPicons

	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,代码行数:28,代码来源:geradorpicons.py

示例3: render

    def render(self, req):
        try:
            w1 = req.uri.split("?")[1]
            w2 = w1.split("&")
            parts = {}
            for i in w2:
                w3 = i.split("=")
                parts[w3[0]] = w3[1]
        except:
            req.setResponseCode(200)
            return "no ref given with ref=???"

        if parts.has_key("ref"):
            s = "<br/>"

            ref = parts["ref"].replace("%20", " ").replace("%3A", ":").replace("%22", '"')
            print ref
            fav = eServiceReference(ref)
            services = ServiceList(fav, command_func=None, validate_commands=False)
            sub = services.getServicesAsList()

            if len(sub) > 0:
                for (ref, name) in sub:
                    s = s + "<p>"
                    s = s + '<a href="http://%s:8001/%s" vod>%s</a>' % (req.host.host, ref, name)
                req.setResponseCode(200)
                req.setHeader("Content-type", "text/html")
                return s
        else:
            req.setResponseCode(200)
            return "no ref"
开发者ID:23devillson,项目名称:E2-OpenPlugins,代码行数:31,代码来源:plugin.py

示例4: getChannelList

	def getChannelList(self):
		if not self._channelList:
			from Components.Sources.ServiceList import ServiceList
			bouquet = eServiceReference('1:7:1:0:0:0:0:0:0:0:FROM BOUQUET "userbouquet.favourites.tv" ORDER BY bouquet')
			slist = ServiceList(bouquet, validate_commands=False)
			services = slist.getServicesAsList(format="S")
			self._channelList = services[:]
		return self._channelList
开发者ID:Blacksens,项目名称:enigma2-plugins,代码行数:8,代码来源:SVDRP.py

示例5: escreveRefresh

	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,代码行数:55,代码来源:easybouquets.py

示例6: LSTC

	def LSTC(self, args):
		if args:
			payload = "%d parameter not implemented" % (CODE_IMP_PARAM,)
			return self.sendLine(payload)
		from Components.Sources.ServiceList import ServiceList
		bouquet = eServiceReference('1:7:1:0:0:0:0:0:0:0:FROM BOUQUET "userbouquet.favourites.tv" ORDER BY bouquet')
		slist = ServiceList(bouquet, validate_commands=False)
		services = slist.getServicesAsList(format="SNn")
		if services:
			def getServiceInfoValue(info, sref, what):
				if info is None: return ""
				v = info.getInfo(sref.ref, what)
				if v == -2: return info.getInfoString(sref.ref, what)
				elif v == -1: return "N/A"
				return v
			def sendServiceLine(service, counter, last=False):
				if service[0][:5] == '1:64:':
					# format for markers:  ":Name"
					line = "%d%s:%s" % (CODE_OK, '-' if not last else ' ', service[1])
				else:
					# <id> <full name>,<short name>;<provider>:<freq>:<parameters>:<source>:<srate>:<vpid>:<apid>:<tpid>:<conditional access>:<:sid>:<nid>:<tid>:<:rid>
					# e.g. 5  RTL Television,RTL:12188:h:S19.2E:27500:163:104:105:0:12003:1:1089:0
					sref = ServiceReference(service[0])
					info = sref.info()
					# XXX: how to get this?! o0
					feinfo = None #sref.ref.frontendInfo()
					fedata = feinfo.getAll(True) if feinfo else {}
					prov = getServiceInfoValue(info, sref, iServiceInformation.sProvider)
					frequency = fedata.get("frequency", 0)/1000
					param = -1
					source = '-1'
					srate = -1
					vpid = '-1'
					apid = '-1'
					tpid = -1
					ca = '-1'
					sid = -1
					nid = -1
					tid = -1
					rid = -1
					# TODO: support full format, these are only the important fields ;)
					line = "%d%s%d %s,%s;%s:%d:%s:%s:%d:%s:%s:%d:%s:%d:%d:%d:%d" % (CODE_OK, '-' if not last else ' ', counter, service[1], service[2], prov, frequency, param, source, srate, vpid, apid, tpid, ca, sid, nid, tid, rid)
				self.sendLine(line)

			self.channelList = [x[0] for x in services] # always refresh cache b/c this is what the user works with from now on
			lastItem = services.pop()
			idx = 1
			for service in services:
				sendServiceLine(service, idx)
				idx += 1
			sendServiceLine(lastItem, idx, last=True)
		else:
			payload = "%d no services found" % (CODE_ERR_LOCAL,)
			self.sendLine(payload)
开发者ID:Blacksens,项目名称:enigma2-plugins,代码行数:54,代码来源:SVDRP.py

示例7: getServices

def getServices(sRef):
    services = []

    if sRef == "":
        sRef = '%s FROM BOUQUET "bouquets.tv" ORDER BY bouquet' % (service_types_tv)

    servicelist = ServiceList(eServiceReference(sRef))
    slist = servicelist.getServicesAsList()
    for sitem in slist:
        service = {}
        service["servicereference"] = sitem[0]
        service["servicename"] = sitem[1]
        services.append(service)

    return {"services": services}
开发者ID:nobody9,项目名称:e2openplugin-OpenWebif,代码行数:15,代码来源:services.py

示例8: buildList

	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
开发者ID:TitanNit,项目名称:tdt,代码行数:32,代码来源:ServiceListRecursive.py

示例9: buildList

	def buildList(self, ref, epg):
		self.servicelist = ServiceList(ref, command_func = self.getServiceList, validate_commands=False)
		list = self.servicelist.getServicesAsList()
		E2List = [] 
		for index in range(len(list)): 
			item = list[index]
			servicereference = item[0]
			servicename = item[1]
			eventstart = 0
			eventduration = 0
			eventtitle = ""
			eventid = 0
			eventdescription = ""
			eventdescriptionextended = ""
			if epg:
				epgref = item[0]
				events = self.epgcache.lookupEvent(['IBDTSERNX', (epgref, 0, -1)])
				if events:
					if events[0][0] is not None:
						eventid =  events[0][0]
					if events[0][1] is not None:
						eventstart =  events[0][1]
					if events[0][2] is not None:
						eventduration =  events[0][2]
					if events[0][3] is not None:
						eventtitle = events[0][3]
					if events[0][4] is not None:
						eventdescription= events[0][4]
					if events[0][5] is not None:
						eventdescriptionextended= events[0][5]
				E2List.append(E2EPGListAllData(servicereference = servicereference, servicename = servicename, eventstart = eventstart, eventduration = eventduration, eventtitle = eventtitle, eventid = eventid, eventdescription= eventdescription, eventdescriptionextended = eventdescriptionextended))
			else:
					E2List.append(E2ServiceList(servicereference = item[0], servicename = item[1]))
		return E2List
开发者ID:13K-OMAR,项目名称:enigma2-plugins-sh4,代码行数:34,代码来源:Services.py

示例10: getServices

def getServices(sRef, showAll=True, showHidden=False, pos=0, provider=False, picon=False):
	services = []
	allproviders = {}

	if sRef == "":
		sRef = '%s FROM BOUQUET "bouquets.tv" ORDER BY bouquet' % (service_types_tv)

	if provider:
		s_type = service_types_tv
		if "radio" in sRef:
			s_type = service_types_radio
		pserviceHandler = eServiceCenter.getInstance()
		pservices = pserviceHandler.list(eServiceReference('%s FROM PROVIDERS ORDER BY name' % (s_type)))
		providers = pservices and pservices.getContent("SN", True)

		if provider:
			for provider in providers:
				servicelist = ServiceList(eServiceReference(provider[0]))
				slist = servicelist.getServicesAsList()
				for sitem in slist:
					allproviders[sitem[0]] = provider[1]

	servicelist = ServiceList(eServiceReference(sRef))
	slist = servicelist.getServicesAsList()

	for sitem in slist:
		st = int(sitem[0].split(":")[1])
		if (sitem[0][:7] == '1:832:D') or (not (st & 512) and not (st & 64)):
			pos = pos + 1
		if not st & 512 or showHidden:
			if showAll or st == 0:
				service = {}
				service['pos'] = 0 if (st & 64) else pos
				sr = unicode(sitem[0], 'utf_8', errors='ignore').encode('utf_8', 'ignore')
				if picon:
					service['picon'] = getPicon(sr)
				service['servicereference'] = sr
				service['program'] = int(service['servicereference'].split(':')[3], 16)
				service['servicename'] = unicode(sitem[1], 'utf_8', errors='ignore').encode('utf_8', 'ignore')
				if provider:
					if sitem[0] in allproviders:
						service['provider'] = allproviders[sitem[0]]
					else:
						service['provider'] = ""
				services.append(service)

	return {"services": services, "pos": pos}
开发者ID:OpenESI,项目名称:e2openplugin-OpenWebif,代码行数:47,代码来源:services.py

示例11: getServices

def getServices(sRef):
	services = []

	if sRef == "":
		sRef = '%s FROM BOUQUET "bouquets.tv" ORDER BY bouquet' % (service_types_tv)

	servicelist = ServiceList(eServiceReference(sRef))
	slist = servicelist.getServicesAsList()

	for sitem in slist:
		if not int(sitem[0].split(":")[1]) & 512:	# 512 is hidden service on sifteam image. Doesn't affect other images
			service = {}
			service['servicereference'] = sitem[0]
			service['servicename'] = sitem[1]
			services.append(service)

	return { "services": services }
开发者ID:mikola-mail,项目名称:e2openplugin-OpenWebif,代码行数:17,代码来源:services.py

示例12: getServices

def getServices(sRef, showAll = True, showHidden = False):
	services = []

	if sRef == "":
		sRef = '%s FROM BOUQUET "bouquets.tv" ORDER BY bouquet' % (service_types_tv)

	servicelist = ServiceList(eServiceReference(sRef))
	slist = servicelist.getServicesAsList()

	for sitem in slist:
		st = int(sitem[0].split(":")[1])
		if not st & 512 or showHidden:
			if showAll or st == 0: 
				service = {}
				service['servicereference'] = sitem[0].encode("utf8")
				service['servicename'] = sitem[1].encode("utf8")
				services.append(service)

	return { "services": services }
开发者ID:athoik,项目名称:e2openplugin-OpenWebif,代码行数:19,代码来源:services.py

示例13: render

	def render(self, req):
		s = '<br/>'
		if config.usage.multibouquet.value:
			bouquet_rootstr = '1:7:1:0:0:0:0:0:0:0:FROM BOUQUET "bouquets.tv" ORDER BY bouquet'
		else:
			from Screens.ChannelSelection import service_types_tv
			bouquet_rootstr = '%s FROM BOUQUET "userbouquet.favourites.tv" ORDER BY bouquet'%(service_types_tv)
		fav = eServiceReference(bouquet_rootstr)
		services = ServiceList(fav, command_func = None, validate_commands = False)
		sub = services.getServicesAsList()
		if len(sub) > 0:
			self.putChild('channel', ChannelList())
			for (ref, name) in sub:
				s = s + '<p>'
				ref = ref.replace(' ', '%20').replace(':', '%3A').replace('"', '%22')
				s = s + '<a href="/channel?ref=' + ref + '">' + name + '</a>'
			req.setResponseCode(200)
			req.setHeader('Content-type', 'text/html');
			return s;
开发者ID:E2OpenPlugins,项目名称:e2openplugin-StreamInterface,代码行数:19,代码来源:plugin.py

示例14: getServices

def getServices(sRef, showAll = True, showHidden = False):
	services = []

	if sRef == "":
		sRef = '%s FROM BOUQUET "bouquets.tv" ORDER BY bouquet' % (service_types_tv)

	servicelist = ServiceList(eServiceReference(sRef))
	slist = servicelist.getServicesAsList()

	for sitem in slist:
		st = int(sitem[0].split(":")[1])
		if not st & 512 or showHidden:
			if showAll or st == 0:
				service = {}
				service['servicereference'] = unicode(sitem[0], 'utf_8', errors='ignore').encode('utf_8', 'ignore')
				service['program'] = int(service['servicereference'].split(':')[3], 16)
				service['servicename'] = unicode(sitem[1], 'utf_8', errors='ignore').encode('utf_8', 'ignore')
				services.append(service)

	return { "services": services }
开发者ID:Dima73,项目名称:e2openplugin-OpenWebif,代码行数:20,代码来源:services.py

示例15: _init_services

	def _init_services(self, ref):
		self.info(ref)
		servicelist = None
		def get_servicelist(ref):
			servicelist.root = ref
		if ref:
			ref = eServiceReference(ref)
			if not ref.valid():
				self.warning("Invalid ref %s" % ref)
				return []
		else:
			self.warning("Missing ref!")

		servicelist = ServiceList(ref, command_func=get_servicelist, validate_commands=False)
		services = servicelist.getServicesAsList()
		for ref, name in services:
			if ref.startswith("1:64"): #skip markers
				continue
			child = self._gen_child(ref, name)
			self.add_child(child)
开发者ID:OpenDMM,项目名称:enigma2,代码行数:20,代码来源:DreamboxMediaStore.py


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