From: smlee Date: Tue, 9 Jul 2013 10:38:49 +0000 (+0900) Subject: add Tools/Alternatives.py X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=commitdiff_plain;h=58a36af1c42cb0a7b4e69c579c08cb29b9cb13b7 add Tools/Alternatives.py --- diff --git a/lib/python/Tools/Alternatives.py b/lib/python/Tools/Alternatives.py new file mode 100644 index 0000000..742f3ca --- /dev/null +++ b/lib/python/Tools/Alternatives.py @@ -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 diff --git a/lib/python/Tools/Makefile.am b/lib/python/Tools/Makefile.am index aeeb954..5818100 100644 --- a/lib/python/Tools/Makefile.am +++ b/lib/python/Tools/Makefile.am @@ -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