set platform profile and check application version.
[vuplus_dvbapp] / lib / python / Screens / AudioSelection.py
index b3b82b4..6de9fcd 100644 (file)
@@ -1,6 +1,6 @@
 from Screen import Screen
 from Components.ServiceEventTracker import ServiceEventTracker
 from Screen import Screen
 from Components.ServiceEventTracker import ServiceEventTracker
-from Components.ActionMap import ActionMap
+from Components.ActionMap import NumberActionMap
 from Components.ConfigList import ConfigListScreen
 from Components.ChoiceList import ChoiceList, ChoiceEntryComponent
 from Components.config import config, ConfigSubsection, getConfigListEntry, ConfigNothing, ConfigSelection, ConfigOnOff
 from Components.ConfigList import ConfigListScreen
 from Components.ChoiceList import ChoiceList, ChoiceEntryComponent
 from Components.config import config, ConfigSubsection, getConfigListEntry, ConfigNothing, ConfigSelection, ConfigOnOff
@@ -36,7 +36,7 @@ class AudioSelection(Screen, ConfigListScreen):
                self.cached_subtitle_checked = False
                self.__selected_subtitle = None
         
                self.cached_subtitle_checked = False
                self.__selected_subtitle = None
         
-               self["actions"] = ActionMap(["ColorActions", "SetupActions", "DirectionActions"],
+               self["actions"] = NumberActionMap(["ColorActions", "SetupActions", "DirectionActions"],
                {
                        "red": self.keyRed,
                        "green": self.keyGreen,
                {
                        "red": self.keyRed,
                        "green": self.keyGreen,
@@ -46,7 +46,16 @@ class AudioSelection(Screen, ConfigListScreen):
                        "cancel": self.cancel,
                        "up": self.keyUp,
                        "down": self.keyDown,
                        "cancel": self.cancel,
                        "up": self.keyUp,
                        "down": self.keyDown,
-               }, -3)
+                       "1": self.keyNumberGlobal,
+                       "2": self.keyNumberGlobal,
+                       "3": self.keyNumberGlobal,
+                       "4": self.keyNumberGlobal,
+                       "5": self.keyNumberGlobal,
+                       "6": self.keyNumberGlobal,
+                       "7": self.keyNumberGlobal,
+                       "8": self.keyNumberGlobal,
+                       "9": self.keyNumberGlobal,
+               }, -2)
 
                self.settings = ConfigSubsection()
                choicelist = [(PAGE_AUDIO,_("audio tracks")), (PAGE_SUBTITLES,_("Subtitles"))]
 
                self.settings = ConfigSubsection()
                choicelist = [(PAGE_AUDIO,_("audio tracks")), (PAGE_SUBTITLES,_("Subtitles"))]
@@ -62,17 +71,16 @@ class AudioSelection(Screen, ConfigListScreen):
                streams = []
                conflist = []
                selectedidx = 0
                streams = []
                conflist = []
                selectedidx = 0
-               
-               service = self.session.nav.getCurrentService()
-               self.audioTracks = audio = service and service.audioTracks()
-               n = audio and audio.getNumberOfTracks() or 0
-               
+
                if self.settings.menupage.getValue() == PAGE_AUDIO:
                        self.setTitle(_("Select audio track"))
                if self.settings.menupage.getValue() == PAGE_AUDIO:
                        self.setTitle(_("Select audio track"))
+                       service = self.session.nav.getCurrentService()
+                       self.audioTracks = audio = service and service.audioTracks()
+                       n = audio and audio.getNumberOfTracks() or 0
                        if SystemInfo["CanDownmixAC3"]:
                                self.settings.downmix = ConfigOnOff(default=config.av.downmix_ac3.value)
                                self.settings.downmix.addNotifier(self.changeAC3Downmix, initial_call = False)
                        if SystemInfo["CanDownmixAC3"]:
                                self.settings.downmix = ConfigOnOff(default=config.av.downmix_ac3.value)
                                self.settings.downmix.addNotifier(self.changeAC3Downmix, initial_call = False)
-                               conflist.append(getConfigListEntry(_("AC3 downmix"), self.settings.downmix))
+                               conflist.append(getConfigListEntry(_("Dolby Digital downmix"), self.settings.downmix))
                                self["key_red"].setBoolean(True)
 
                        if n > 0:
                                self["key_red"].setBoolean(True)
 
                        if n > 0:
@@ -88,7 +96,7 @@ class AudioSelection(Screen, ConfigListScreen):
                                        self["key_green"].setBoolean(False)
                                selectedAudio = self.audioTracks.getCurrentTrack()
                                for x in range(n):
                                        self["key_green"].setBoolean(False)
                                selectedAudio = self.audioTracks.getCurrentTrack()
                                for x in range(n):
-                                       number = str(x)
+                                       number = str(x + 1)
                                        i = audio.getTrackInfo(x)
                                        languages = i.getLanguage().split('/')
                                        description = i.getDescription() or _("<unknown>")
                                        i = audio.getTrackInfo(x)
                                        languages = i.getLanguage().split('/')
                                        description = i.getDescription() or _("<unknown>")
@@ -160,7 +168,7 @@ class AudioSelection(Screen, ConfigListScreen):
                                                number = "%x%02x" % (x[3],x[2])
 
                                        elif x[0] == 2:
                                                number = "%x%02x" % (x[3],x[2])
 
                                        elif x[0] == 2:
-                                               types = ("UTF-8 text","SSA / AAS",".SRT file","VOB")
+                                               types = (_("<unknown>"), "UTF-8 text", "SSA", "AAS", ".SRT file", "VOB", "PGS (unsupported)")
                                                description = types[x[2]]
 
                                        streams.append((x, "", number, description, language, selected))
                                                description = types[x[2]]
 
                                        streams.append((x, "", number, description, language, selected))
@@ -189,7 +197,7 @@ class AudioSelection(Screen, ConfigListScreen):
                                conflist.append(getConfigListEntry(Plugins[0][0], ConfigNothing()))
                                self.plugincallfunc = Plugins[0][1]
                        if len(Plugins) > 1:
                                conflist.append(getConfigListEntry(Plugins[0][0], ConfigNothing()))
                                self.plugincallfunc = Plugins[0][1]
                        if len(Plugins) > 1:
-                               print "these plugins are installed but not displayed in the dialog box:", Plugins[1:]
+                               print "plugin(s) installed but not displayed in the dialog box:", Plugins[1:]
 
                self["config"].list = conflist
                self["config"].l.setList(conflist)
 
                self["config"].list = conflist
                self["config"].l.setList(conflist)
@@ -290,11 +298,16 @@ class AudioSelection(Screen, ConfigListScreen):
                elif self.focus == FOCUS_STREAMS:
                        self["streams"].selectNext()
 
                elif self.focus == FOCUS_STREAMS:
                        self["streams"].selectNext()
 
+       def keyNumberGlobal(self, number):
+               if number <= len(self["streams"].list):
+                       self["streams"].setIndex(number-1)
+                       self.keyOk()
+
        def keyOk(self):
                if self.focus == FOCUS_STREAMS and self["streams"].list:
                        cur = self["streams"].getCurrent()
                        if self.settings.menupage.getValue() == PAGE_AUDIO and cur[0] is not None:
        def keyOk(self):
                if self.focus == FOCUS_STREAMS and self["streams"].list:
                        cur = self["streams"].getCurrent()
                        if self.settings.menupage.getValue() == PAGE_AUDIO and cur[0] is not None:
-                               self.changeAudio(cur[2])
+                               self.changeAudio(cur[0])
                                self.__updatedInfo()
                        if self.settings.menupage.getValue() == PAGE_SUBTITLES and cur[0] is not None:
                                if self.infobar.selected_subtitle == cur[0]:
                                self.__updatedInfo()
                        if self.settings.menupage.getValue() == PAGE_SUBTITLES and cur[0] is not None:
                                if self.infobar.selected_subtitle == cur[0]: