def __parse(self, file):
print "[Bonjour.__parse] parsing %s%s" %(self.AVAHI_SERVICES_DIR, file)
try:
config = cet_parse(self.AVAHI_SERVICES_DIR + file).getroot()
except ParseError: #parsing failed, skip the file
return
name = config.find('name').text
service = config.find('service')
type = service.find('type').text
port = service.find('port').text
text = service.findall('txt-record')
textList = []
if text != None:
for txt in text:
textList.append(txt.text)
service = self.buildServiceFull(file, name, type, port, textList)
self.registerService(service)
评论列表
文章目录