PEP8: Fix whitespace
[openblackhole/openblackhole-enigma2.git] / 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(serviceA, serviceB):
8         return serviceA and serviceB and (\
9                 serviceA == serviceB or\
10                 serviceA.startswith('1:134:') and serviceB in getAlternativeChannels(serviceA) or\
11                 serviceB.startswith('1:134:') and serviceA in getAlternativeChannels(serviceB))
12
13 def GetWithAlternative(service):
14         if service.startswith('1:134:'):
15                 channels = getAlternativeChannels(service)
16                 if channels:
17                         return channels[0]
18         return service