本文整理汇总了Python中Components.Sources.ServiceList.ServiceList.getServicesAsList方法的典型用法代码示例。如果您正苦于以下问题:Python ServiceList.getServicesAsList方法的具体用法?Python ServiceList.getServicesAsList怎么用?Python ServiceList.getServicesAsList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Components.Sources.ServiceList.ServiceList
的用法示例。
在下文中一共展示了ServiceList.getServicesAsList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getPicons
# 需要导入模块: from Components.Sources.ServiceList import ServiceList [as 别名]
# 或者: from Components.Sources.ServiceList.ServiceList import getServicesAsList [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
示例2: render
# 需要导入模块: from Components.Sources.ServiceList import ServiceList [as 别名]
# 或者: from Components.Sources.ServiceList.ServiceList import getServicesAsList [as 别名]
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"
示例3: getServices
# 需要导入模块: from Components.Sources.ServiceList import ServiceList [as 别名]
# 或者: from Components.Sources.ServiceList.ServiceList import getServicesAsList [as 别名]
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}
示例4: getChannelList
# 需要导入模块: from Components.Sources.ServiceList import ServiceList [as 别名]
# 或者: from Components.Sources.ServiceList.ServiceList import getServicesAsList [as 别名]
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
示例5: escreveRefresh
# 需要导入模块: from Components.Sources.ServiceList import ServiceList [as 别名]
# 或者: from Components.Sources.ServiceList.ServiceList import getServicesAsList [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()
示例6: LSTC
# 需要导入模块: from Components.Sources.ServiceList import ServiceList [as 别名]
# 或者: from Components.Sources.ServiceList.ServiceList import getServicesAsList [as 别名]
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)
示例7: getServices
# 需要导入模块: from Components.Sources.ServiceList import ServiceList [as 别名]
# 或者: from Components.Sources.ServiceList.ServiceList import getServicesAsList [as 别名]
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}
示例8: getServices
# 需要导入模块: from Components.Sources.ServiceList import ServiceList [as 别名]
# 或者: from Components.Sources.ServiceList.ServiceList import getServicesAsList [as 别名]
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 }
示例9: getServices
# 需要导入模块: from Components.Sources.ServiceList import ServiceList [as 别名]
# 或者: from Components.Sources.ServiceList.ServiceList import getServicesAsList [as 别名]
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 }
示例10: render
# 需要导入模块: from Components.Sources.ServiceList import ServiceList [as 别名]
# 或者: from Components.Sources.ServiceList.ServiceList import getServicesAsList [as 别名]
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;
示例11: _init_services
# 需要导入模块: from Components.Sources.ServiceList import ServiceList [as 别名]
# 或者: from Components.Sources.ServiceList.ServiceList import getServicesAsList [as 别名]
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)
示例12: getServices
# 需要导入模块: from Components.Sources.ServiceList import ServiceList [as 别名]
# 或者: from Components.Sources.ServiceList.ServiceList import getServicesAsList [as 别名]
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 }
示例13: escreveCanais
# 需要导入模块: from Components.Sources.ServiceList import ServiceList [as 别名]
# 或者: from Components.Sources.ServiceList.ServiceList import getServicesAsList [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)
示例14: do_populate
# 需要导入模块: from Components.Sources.ServiceList import ServiceList [as 别名]
# 或者: from Components.Sources.ServiceList.ServiceList import getServicesAsList [as 别名]
def do_populate(parent=None):
if parent.external_id == None:
self.warning("Invalid ref %s" %parent.external_id)
return
servicelist = None
def get_servicelist(ref):
servicelist.root = ref
ref = eServiceReference(parent.external_id)
if not ref.valid():
self.warning("Invalid ref %s" %parent.external_id)
return
servicelist = ServiceList(ref, command_func=get_servicelist, validate_commands=False)
services = servicelist.getServicesAsList()
snum = 1
isChannelList = False
for sref, name in services:
name = unicode(name.replace('\xc2\x86', '').replace('\xc2\x87', ''), errors='ignore')
item = None
if sref.startswith("1:7:"): #Bouquet
item = LazyContainer(parent, name, childrenRetriever=retriever)
else:
isChannelList = True
if not sref.startswith("1:64:"): # skip markers
url = 'http://' + self.streaminghost + ':8001/' + sref
item = DreamboxService(name, url, snum, parent)
snum += 1
if item is not None:
parent.add_child(item, external_id=sref)
if isChannelList:
def sort(x, y):
return cmp(x.get_service_number(), y.get_service_number())
parent.sorting_method = sort
示例15: ServiceListRecursive
# 需要导入模块: from Components.Sources.ServiceList import ServiceList [as 别名]
# 或者: from Components.Sources.ServiceList.ServiceList import getServicesAsList [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("&", "&").replace("<", "<").replace('"', '"').replace(">", ">")
return item
def getServiceList(self, ref):
self.servicelist.root = ref
text = property(do_func)