def getPiconLName(serviceName):
#remove the path and name fields, and replace ':' by '_'
sname = '_'.join(GetWithAlternative(serviceName).split(':', 10)[:10])
pngname = findPiconL(sname)
if not pngname:
fields = sname.split('_', 3)
if len(fields) > 2 and fields[2] != '2':
#fallback to 1 for tv services with nonstandard servicetypes
fields[2] = '1'
pngname = findPiconL('_'.join(fields))
if not pngname: # picon by channel name
name = ServiceReference(serviceName).getServiceName()
name = unicodedata.normalize('NFKD', unicode(name, 'utf_8', errors='ignore')).encode('ASCII', 'ignore')
excludeChars = ['/', '\\', '\'', '"', '`', '?', ' ', '(', ')', ':', '<', '>', '|', '.', '\n']
name = re.sub('[%s]' % ''.join(excludeChars), '', name)
name = name.replace('&', 'and')
name = name.replace('+', 'plus')
name = name.replace('*', 'star')
name = name.lower()
if len(name) > 0:
pngname = findPicon(name)
if not pngname and len(name) > 2 and name.endswith('hd'):
pngname = findPicon(name[:-2])
return pngname
评论列表
文章目录