add Tools/Alternatives.py
[vuplus_dvbapp] / lib / python / Tools / Alternatives.py
1 from enigma import eServiceCenter, eServiceReference 
2
3 def getAlternativeChannels(service):
4         alternativeServices = eServiceCenter.getInstance().list(eServiceReference(service))
5         return alternativeServices and alternativeServices.getContent("S", True)
6
7 def CompareWithAlternatives(service,serviceToCompare):
8         if service == serviceToCompare:
9                 return True
10         if service.startswith('1:134:'):
11                 for channel in getAlternativeChannels(service):
12                         if channel == serviceToCompare:
13                                 return True
14         return False
15
16 def GetWithAlternative(service):
17         if service.startswith('1:134:'):
18                 channels = getAlternativeChannels(service)
19                 if channels:
20                         return channels[0]
21         return service