add Tools/Alternatives.py
authorsmlee <smlee@dev3>
Tue, 9 Jul 2013 10:38:49 +0000 (19:38 +0900)
committersmlee <smlee@dev3>
Tue, 9 Jul 2013 10:38:49 +0000 (19:38 +0900)
lib/python/Tools/Alternatives.py [new file with mode: 0644]
lib/python/Tools/Makefile.am

diff --git a/lib/python/Tools/Alternatives.py b/lib/python/Tools/Alternatives.py
new file mode 100644 (file)
index 0000000..742f3ca
--- /dev/null
@@ -0,0 +1,21 @@
+from enigma import eServiceCenter, eServiceReference 
+
+def getAlternativeChannels(service):
+       alternativeServices = eServiceCenter.getInstance().list(eServiceReference(service))
+       return alternativeServices and alternativeServices.getContent("S", True)
+
+def CompareWithAlternatives(service,serviceToCompare):
+       if service == serviceToCompare:
+               return True
+       if service.startswith('1:134:'):
+               for channel in getAlternativeChannels(service):
+                       if channel == serviceToCompare:
+                               return True
+       return False
+
+def GetWithAlternative(service):
+       if service.startswith('1:134:'):
+               channels = getAlternativeChannels(service)
+               if channels:
+                       return channels[0]
+       return service
\ No newline at end of file
index aeeb954..5818100 100644 (file)
@@ -5,4 +5,4 @@ install_PYTHON = \
        KeyBindings.py BoundFunction.py ISO639.py Notifications.py __init__.py \
        RedirectOutput.py DreamboxHardware.py Import.py Event.py CList.py \
        LoadPixmap.py Profile.py HardwareInfo.py Transponder.py ASCIItranslit.py \
-       Downloader.py
+       Downloader.py Alternatives.py