Merge commit 'dm/experimental' into test branch
[vuplus_dvbapp] / lib / python / Screens / AudioSelection.py
index a0bfcab..ab1344d 100644 (file)
@@ -46,7 +46,7 @@ class AudioSelection(Screen, ConfigListScreen):
                        "cancel": self.cancel,
                        "up": self.keyUp,
                        "down": self.keyDown,
-               }, -3)
+               }, -2)
 
                self.settings = ConfigSubsection()
                choicelist = [(PAGE_AUDIO,_("audio tracks")), (PAGE_SUBTITLES,_("Subtitles"))]
@@ -62,26 +62,29 @@ class AudioSelection(Screen, ConfigListScreen):
                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"))
+                       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)
-                               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.audioChannel = service.audioChannel()
-                               choicelist = [("0",_("left")), ("1",_("stereo")), ("2", _("right"))]
-                               self.settings.channelmode = ConfigSelection(choices = choicelist, default = str(self.audioChannel.getCurrentChannel()))
-                               self.settings.channelmode.addNotifier(self.changeMode, initial_call = False)
-                               conflist.append(getConfigListEntry(_("Channel"), self.settings.channelmode))
-                               self["key_green"].setBoolean(True)
+                               if self.audioChannel:
+                                       choicelist = [("0",_("left")), ("1",_("stereo")), ("2", _("right"))]
+                                       self.settings.channelmode = ConfigSelection(choices = choicelist, default = str(self.audioChannel.getCurrentChannel()))
+                                       self.settings.channelmode.addNotifier(self.changeMode, initial_call = False)
+                                       conflist.append(getConfigListEntry(_("Channel"), self.settings.channelmode))
+                                       self["key_green"].setBoolean(True)
+                               else:
+                                       conflist.append(('',))
+                                       self["key_green"].setBoolean(False)
                                selectedAudio = self.audioTracks.getCurrentTrack()
                                for x in range(n):
                                        number = str(x)
@@ -137,7 +140,7 @@ class AudioSelection(Screen, ConfigListScreen):
                                        language = _("<unknown>")
                                        selected = ""
 
-                                       if sel and x[:4] == sel[:4]:
+                                       if sel and x == sel:
                                                selected = _("Running")
                                                selectedidx = idx
                                        
@@ -156,7 +159,7 @@ class AudioSelection(Screen, ConfigListScreen):
                                                number = "%x%02x" % (x[3],x[2])
 
                                        elif x[0] == 2:
-                                               types = ("UTF-8 text","SSA / AAS",".SRT file")
+                                               types = (_("<unknown>"), "UTF-8 text", "SSA", "AAS", ".SRT file", "VOB", "PGS (unsupported)")
                                                description = types[x[2]]
 
                                        streams.append((x, "", number, description, language, selected))
@@ -185,7 +188,7 @@ class AudioSelection(Screen, ConfigListScreen):
                                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)
@@ -219,7 +222,7 @@ class AudioSelection(Screen, ConfigListScreen):
                config.av.downmix_ac3.save()
 
        def changeMode(self, mode):
-               if mode is not None:
+               if mode is not None and self.audioChannel:
                        self.audioChannel.selectChannel(int(mode.getValue()))
 
        def changeAudio(self, audio):