def setAudioTrack(service): try: from Tools.ISO639 import LanguageCodes as langC tracks = service and service.audioTracks() nTracks = tracks and tracks.getNumberOfTracks() or 0 if not nTracks: return idx = 0 trackList = [] for i in xrange(nTracks): audioInfo = tracks.getTrackInfo(i) lang = audioInfo.getLanguage() if langC.has_key(lang): lang = langC[lang][0] desc = audioInfo.getDescription() track = (idx, lang, desc) idx += 1 trackList += [track] seltrack = tracks.getCurrentTrack() from Components.Language import language syslang = language.getLanguage()[:2] syslang = langC[syslang][0] if (config.autolanguage.audio_autoselect1.value or config.autolanguage.audio_autoselect2.value or config.autolanguage.audio_autoselect3.value or config.autolanguage.audio_autoselect4.value) != '---': audiolang = [ config.autolanguage.audio_autoselect1.value, config.autolanguage.audio_autoselect2.value, config.autolanguage.audio_autoselect3.value, config.autolanguage.audio_autoselect4.value ] caudiolang = True else: audiolang = syslang caudiolang = False useAc3 = config.autolanguage.audio_defaultac3.value if useAc3: matchedAc3 = tryAudioTrack(tracks, audiolang, caudiolang, trackList, seltrack, useAc3) if matchedAc3: return matchedMpeg = tryAudioTrack(tracks, audiolang, caudiolang, trackList, seltrack, False) if matchedMpeg: return tracks.selectTrack(0) return matchedMpeg = tryAudioTrack(tracks, audiolang, caudiolang, trackList, seltrack, False) if matchedMpeg: return matchedAc3 = tryAudioTrack(tracks, audiolang, caudiolang, trackList, seltrack, useAc3) if matchedAc3: return tracks.selectTrack(0) except Exception as e: print '[MoviePlayer] audioTrack exception:\n' + str(e)
def getAudioTracks(session): service = session.nav.getCurrentService() audio = service and service.audioTracks() ret = { "tracklist": [], "result": False } if audio is not None and service is not None: current = audio.getCurrentTrack() for i in range(0, audio.getNumberOfTracks()): track = audio.getTrackInfo(i) languages = track.getLanguage().split('/') language = "" for lang in languages: if len(language) > 0: language += " / " if LanguageCodes.has_key(lang): language += LanguageCodes[lang][0] else: language += lang description = track.getDescription() if description: description += " (" + language + ")" else: description = language ret["result"] = True ret["tracklist"].append({ "description": description, "index": i, "pid": track.getPID(), "active": i == current }) return ret
def setAudioTrack(self): try: if not config.suomipoeka.autoaudio.value: return from Tools.ISO639 import LanguageCodes as langC service = self.session.nav.getCurrentService() tracks = service and service.audioTracks() nTracks = tracks and tracks.getNumberOfTracks() or 0 if nTracks == 0: return trackList = [] for i in range(nTracks): audioInfo = tracks.getTrackInfo(i) lang = audioInfo.getLanguage() if langC.has_key(lang): lang = langC[lang][0] desc = audioInfo.getDescription() trackList += [str(lang) + " " + str(desc)] # spDebugOut("[spPlayer] audioTrack language: " + str(lang) + " " + str(desc)) for audiolang in [ config.suomipoeka.audlang1.value, config.suomipoeka.audlang2.value, config.suomipoeka.audlang3.value ]: if self.tryAudioEnable(trackList, audiolang, tracks): break except Exception, e: spDebugOut("[spPlayer] audioTrack exception:\n" + str(e))
def getAudioTracks(session): service = session.nav.getCurrentService() audio = service and service.audioTracks() ret = {"tracklist": [], "result": False} if audio is not None and service is not None: current = audio.getCurrentTrack() for i in range(0, audio.getNumberOfTracks()): track = audio.getTrackInfo(i) languages = track.getLanguage().split('/') language = "" for lang in languages: if len(language) > 0: language += " / " if LanguageCodes.has_key(lang): language += LanguageCodes[lang][0] else: language += lang description = track.getDescription() if description: description += " (" + language + ")" else: description = language ret["result"] = True ret["tracklist"].append({ "description": description, "index": i, "pid": track.getPID(), "active": i == current }) return ret
def language_iso639_2to3(alpha2): if alpha2 in LanguageCodes: language = LanguageCodes[alpha2] for alpha, name in LanguageCodes.items(): if name == language: if len(alpha) == 3: return alpha return alpha2
def language_iso639_2to3(alpha2): ret = alpha2 if alpha2 in LanguageCodes: language = LanguageCodes[alpha2] for alpha, name in LanguageCodes.items(): if name == language: if len(alpha) == 3: return alpha return ret
def getAudioInformation(self): bInitialized = False if self.iService == None: self.initAudio() bInitialized = True # check if we are in a recording lCurPosition = self.cueGetCurrentPosition() if lCurPosition is not None: self.bIsRecording = True # check if downmix is enabled try: bDownmixEnabled = config.av.downmix_ac3.value except: bDownmixEnabled = False oAudioTracks = self.iService and self.iService.audioTracks() n = oAudioTracks and oAudioTracks.getNumberOfTracks() or 0 tlist = [] self.selectedAudioInfo = ("", 0) self.selectedAudioIndex = None if n > 0: self.selectedAudioIndex = oAudioTracks.getCurrentTrack() for x in range(n): i = oAudioTracks.getTrackInfo(x) language = i.getLanguage() description = i.getDescription() if LanguageCodes.has_key(language): language = LanguageCodes[language][0] if len(description): description += " (" + language + ")" else: description = language tlist.append((description, x)) if x == self.selectedAudioIndex: if ((description.find("AC3") != -1 or description.find("AC-3") != -1) and not bDownmixEnabled ) or description.find("DTS") != -1: self.whichAudio = AC3 self.channelAudio = AC3 else: self.whichAudio = PCM self.channelAudio = PCM self.selectedAudioInfo = (description, x) tlist.sort(key=lambda x: x[0]) self.audioTrackList = tlist for sAudio in AC3PCM: self.systemDelay[sAudio] = self.getSystemDelay(sAudio) del oAudioTracks if bInitialized == True: self.deleteAudio()
def getAudioInformation(self): bInitialized = False if self.iService == None: self.initAudio() bInitialized = True # check if we are in a recording lCurPosition = self.cueGetCurrentPosition() if lCurPosition is not None: self.bIsRecording = True # check if downmix is enabled try: bDownmixEnabled = config.av.downmix_ac3.value except: bDownmixEnabled = False oAudioTracks = self.iService and self.iService.audioTracks() n = oAudioTracks and oAudioTracks.getNumberOfTracks() or 0 tlist = [] self.selectedAudioInfo = ("", 0) self.selectedAudioIndex = None if n > 0: self.selectedAudioIndex = oAudioTracks.getCurrentTrack() for x in range(n): i = oAudioTracks.getTrackInfo(x) language = i.getLanguage() description = i.getDescription() if LanguageCodes.has_key(language): language = LanguageCodes[language][0] if len(description): description += " (" + language + ")" else: description = language tlist.append((description, x)) if x == self.selectedAudioIndex: if ((description.find("AC3") != -1 or description.find("AC-3") != -1) and not bDownmixEnabled) or description.find("DTS") != -1: self.whichAudio = AC3 self.channelAudio = AC3 else: self.whichAudio = PCM self.channelAudio = PCM self.selectedAudioInfo = (description, x) tlist.sort(key=lambda x: x[0]) self.audioTrackList = tlist for sAudio in AC3PCM: self.systemDelay[sAudio]=self.getSystemDelay(sAudio) del oAudioTracks if bInitialized == True: self.deleteAudio()
def fillList(self): list = self.list del list[:] print "self.list", list if self.subtitlesEnabled(): list.append(getConfigListEntry(_("Disable Subtitles"), ConfigNothing(), None)) sel = self.infobar.selected_subtitle else: sel = None for x in self.getSubtitleList(): if sel and sel[:4] == x[:4]: #ignore Language code in compare text = _("Running") else: text = _("Enable") if x[0] == 0: if LanguageCodes.has_key(x[4]): list.append(getConfigListEntry(text+" DVB "+LanguageCodes[x[4]][0], ConfigNothing(), x)) else: list.append(getConfigListEntry(text+" DVB "+x[4], ConfigNothing(), x)) elif x[0] == 1: if x[4] == 'und': #undefined list.append(getConfigListEntry(text+" TTX "+_("Page")+" %x%02x"%(x[3],x[2]), ConfigNothing(), x)) else: if LanguageCodes.has_key(x[4]): list.append(getConfigListEntry(text+" TTX "+_("Page")+" %x%02x"%(x[3],x[2])+" "+LanguageCodes[x[4]][0], ConfigNothing(), x)) else: list.append(getConfigListEntry(text+" TTX "+_("Page")+" %x%02x"%(x[3],x[2])+" "+x[4], ConfigNothing(), x)) elif x[0] == 2: types = (" UTF-8 text "," SSA / AAS "," .SRT file ") if x[4] == 'und': #undefined list.append(getConfigListEntry(text+types[x[2]]+_("Subtitles")+" %d" % x[1], ConfigNothing(), x)) else: if LanguageCodes.has_key(x[4]): list.append(getConfigListEntry(text+types[x[2]]+_("Subtitles") + ' ' + LanguageCodes[x[4]][0], ConfigNothing(), x)) else: list.append(getConfigListEntry(text+types[x[2]]+_("Subtitles")+" %d " % x[1] +x[4], ConfigNothing(), x)) # return _("Disable subtitles") self["config"].list = list self["config"].l.setList(list)
def setAudioTrack(service): try: from Tools.ISO639 import LanguageCodes as langC tracks = service and service.audioTracks() nTracks = tracks and tracks.getNumberOfTracks() or 0 if not nTracks: return idx = 0 trackList = [] for i in xrange(nTracks): audioInfo = tracks.getTrackInfo(i) lang = audioInfo.getLanguage() if langC.has_key(lang): lang = langC[lang][0] desc = audioInfo.getDescription() track = (idx, lang, desc) idx += 1 trackList += [track] seltrack = tracks.getCurrentTrack() from Components.Language import language syslang = language.getLanguage()[:2] syslang = langC[syslang][0] if (config.autolanguage.audio_autoselect1.value or config.autolanguage.audio_autoselect2.value or config.autolanguage.audio_autoselect3.value or config.autolanguage.audio_autoselect4.value) != '---': audiolang = [config.autolanguage.audio_autoselect1.value, config.autolanguage.audio_autoselect2.value, config.autolanguage.audio_autoselect3.value, config.autolanguage.audio_autoselect4.value] caudiolang = True else: audiolang = syslang caudiolang = False useAc3 = config.autolanguage.audio_defaultac3.value if useAc3: matchedAc3 = tryAudioTrack(tracks, audiolang, caudiolang, trackList, seltrack, useAc3) if matchedAc3: return matchedMpeg = tryAudioTrack(tracks, audiolang, caudiolang, trackList, seltrack, False) if matchedMpeg: return tracks.selectTrack(0) return matchedMpeg = tryAudioTrack(tracks, audiolang, caudiolang, trackList, seltrack, False) if matchedMpeg: return matchedAc3 = tryAudioTrack(tracks, audiolang, caudiolang, trackList, seltrack, useAc3) if matchedAc3: return tracks.selectTrack(0) except Exception as e: print '[MoviePlayer] audioTrack exception:\n' + str(e)
def setSubtitleState(self, enabled): try: if not config.EMC.autosubs.value or not enabled: return from Tools.ISO639 import LanguageCodes as langC subs = self.getCurrentServiceSubtitle() or self.getServiceInterface("subtitle") if subs: lt = [ (e, (e[0] == 0 and "DVB" or e[0] == 1 and "TXT" or "???")) for e in (subs and subs.getSubtitleList() or []) ] if lt: l = [ [e[0], e[1], langC.has_key(e[0][4]) and langC[e[0][4]][0] or e[0][4] ] for e in lt ] if l: for sublang in [config.EMC.sublang1.value, config.EMC.sublang2.value, config.EMC.sublang3.value]: if self.trySubEnable(l, sublang): break except Exception, e: emcDebugOut("[EMCPlayer] setSubtitleState exception:\n" + str(e))
def __init__(self): from Components.Language import language as syslanguage syslang = syslanguage.getLanguage()[:2] self.langdict = { } self.choices = [] for key, val in LanguageCodes.iteritems(): if len(key) == 2: self.langdict[key] = val[0] for key, val in self.langdict.iteritems(): if key not in (syslang, 'en'): self.langdict[key] = val self.choices.append((key, val)) self.choices.sort() self.choices.insert(0,("nolang", ("unspecified"))) self.choices.insert(1,(syslang, self.langdict[syslang])) self.choices.insert(2,("en", self.langdict["en"]))
def __init__(self): from Components.Language import language as syslanguage syslang = syslanguage.getLanguage()[:2] self.langdict = {} self.choices = [] for key, val in LanguageCodes.iteritems(): if len(key) == 2: self.langdict[key] = val[0] for key, val in self.langdict.iteritems(): if key not in (syslang, 'en'): self.langdict[key] = val self.choices.append((key, val)) self.choices.sort() self.choices.insert(0, ("nolang", ("unspecified"))) self.choices.insert(1, (syslang, self.langdict[syslang])) self.choices.insert(2, ("en", self.langdict["en"]))
def getAudioTracks(self): service = self.session.nav.getCurrentService() audio = service and service.audioTracks() n = audio and audio.getNumberOfTracks() or 0 tracklist = [] #check for standby if audio is not None and service is not None: currentTrack = audio.getCurrentTrack() if n > 0: print "[AudioTracks.py] got %s Audiotracks!" % (n) x = 0 while x < n: cnt = 0 i = audio.getTrackInfo(x) languages = i.getLanguage().split('/') description = i.getDescription() pid = i.getPID() language = '' for lang in languages: if cnt: language += ' / ' if LanguageCodes.has_key(lang): language += LanguageCodes[lang][0] else: language += lang cnt += 1 if description: description += " (" + language + ")" else: description = language if x == currentTrack: active = "True" else: active = "False" tracklist.append((description, x, pid, active)) x += 1 return tracklist
def getLanguage(self, DVB_lang): DVB_lang = DVB_lang.lower() for word in ("stereo", "audio", "description", "2ch", "dolby digital"): DVB_lang = DVB_lang.replace(word, "").strip() for key, val in LanguageCodes.iteritems(): if DVB_lang.find(key.lower()) == 0: if len(key) == 2: return key else: DVB_lang = (LanguageCodes[key])[0] elif DVB_lang.find(val[0].lower()) > -1: if len(key) == 2: return key else: DVB_lang = (LanguageCodes[key])[0] for key, val in self.langdict.iteritems(): if val == DVB_lang: return key return "nolang"
def getLanguage(self, DVB_lang): DVB_lang = DVB_lang.lower() for word in ("stereo", "audio", "description", "2ch", "dolby digital"): DVB_lang = DVB_lang.replace(word,"").strip() for key, val in LanguageCodes.iteritems(): if DVB_lang.find(key.lower()) == 0: if len(key) == 2: return key else: DVB_lang = (LanguageCodes[key])[0] elif DVB_lang.find(val[0].lower()) > -1: if len(key) == 2: return key else: DVB_lang = (LanguageCodes[key])[0] for key, val in self.langdict.iteritems(): if val == DVB_lang: return key return "nolang"
def setAudioTrack(self): try: if not config.EMC.autoaudio.value: return from Tools.ISO639 import LanguageCodes as langC service = self.session.nav.getCurrentService() #tracks = service and service.audioTracks() tracks = service and self.getServiceInterface("audioTracks") nTracks = tracks and tracks.getNumberOfTracks() or 0 if not nTracks: return trackList = [] for i in xrange(nTracks): audioInfo = tracks.getTrackInfo(i) lang = audioInfo.getLanguage() if langC.has_key(lang): lang = langC[lang][0] desc = audioInfo.getDescription() trackList += [str(lang) + " " + str(desc)] for audiolang in [config.EMC.audlang1.value, config.EMC.audlang2.value, config.EMC.audlang3.value]: if self.tryAudioEnable(trackList, audiolang, tracks): break except Exception, e: emcDebugOut("[EMCPlayer] audioTrack exception:\n" + str(e))
def fillList(self, arg=None): streams = [] conflist = [] selectedidx = 0 self["key_red"].setBoolean(False) self["key_green"].setBoolean(False) self["key_yellow"].setBoolean(False) self["key_blue"].setBoolean(False) service = self.session.nav.getCurrentService() self.audioTracks = audio = service and service.audioTracks() n = audio and audio.getNumberOfTracks() or 0 subtitlelist = self.getSubtitleList() if self.settings.menupage.value == 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"]: if getBoxType() in ('dm900', 'dm920', 'dm7080', 'dm800'): choice_list = [ ("downmix", _("Downmix")), ("passthrough", _("Passthrough")), ("multichannel", _("convert to multi-channel PCM")), ("hdmi_best", _("use best / controlled by HDMI")) ] self.settings.downmix_ac3 = ConfigSelection( choices=choice_list, default=config.av.downmix_ac3.value) else: self.settings.downmix_ac3 = ConfigOnOff( default=config.av.downmix_ac3.value) self.settings.downmix_ac3.addNotifier(self.changeAC3Downmix, initial_call=False) conflist.append( getConfigListEntry(_("AC3 downmix"), self.settings.downmix_ac3, None)) if SystemInfo["CanDownmixDTS"]: self.settings.downmix_dts = ConfigOnOff( default=config.av.downmix_dts.value) self.settings.downmix_dts.addNotifier(self.changeDTSDownmix, initial_call=False) conflist.append( getConfigListEntry(_("DTS downmix"), self.settings.downmix_dts, None)) if SystemInfo["CanDownmixAAC"]: if getBoxType() in ('dm900', 'dm920', 'dm7080', 'dm800'): choice_list = [ ("downmix", _("Downmix")), ("passthrough", _("Passthrough")), ("multichannel", _("convert to multi-channel PCM")), ("hdmi_best", _("use best / controlled by HDMI")) ] self.settings.downmix_aac = ConfigSelection( choices=choice_list, default=config.av.downmix_aac.value) elif getBoxType() in ('gbquad4k', 'gbue4k'): choice_list = [ ("downmix", _("Downmix")), ("passthrough", _("Passthrough")), ("multichannel", _("convert to multi-channel PCM")), ("force_ac3", _("convert to AC3")), ("force_dts", _("convert to DTS")), ("use_hdmi_cacenter", _("use_hdmi_cacenter")), ("wide", _("wide")), ("extrawide", _("extrawide")) ] self.settings.downmix_aac = ConfigSelection( choices=choice_list, default=config.av.downmix_aac.value) else: self.settings.downmix_aac = ConfigOnOff( default=config.av.downmix_aac.value) self.settings.downmix_aac.addNotifier(self.changeAACDownmix, initial_call=False) conflist.append( getConfigListEntry(_("AAC downmix"), self.settings.downmix_aac, None)) if SystemInfo["CanDownmixAACPlus"]: choice_list = [("downmix", _("Downmix")), ("passthrough", _("Passthrough")), ("multichannel", _("convert to multi-channel PCM")), ("force_ac3", _("convert to AC3")), ("force_dts", _("convert to DTS")), ("use_hdmi_cacenter", _("use_hdmi_cacenter")), ("wide", _("wide")), ("extrawide", _("extrawide"))] self.settings.downmix_aacplus = ConfigSelection( choices=choice_list, default=config.av.downmix_aacplus.value) self.settings.downmix_aacplus.addNotifier( self.changeAACDownmixPlus, initial_call=False) conflist.append( getConfigListEntry(_("AAC Plus downmix"), self.settings.downmix_aacplus, None)) if SystemInfo["CanAACTranscode"]: choice_list = [("off", _("off")), ("ac3", _("AC3")), ("dts", _("DTS"))] self.settings.transcodeaac = ConfigSelection( choices=choice_list, default=config.av.transcodeaac.value) self.settings.transcodeaac.addNotifier(self.setAACTranscode, initial_call=False) conflist.append( getConfigListEntry(_("AAC transcoding"), self.settings.transcodeaac, None)) if SystemInfo["CanAC3plusTranscode"]: if getBoxType() in ('dm900', 'dm920', 'dm7080', 'dm800'): choice_list = [ ("use_hdmi_caps", _("controlled by HDMI")), ("force_ac3", _("convert to AC3")), ("multichannel", _("convert to multi-channel PCM")), ("hdmi_best", _("use best / controlled by HDMI")), ("force_ddp", _("force AC3plus")) ] self.settings.transcodeac3plus = ConfigSelection( choices=choice_list, default=config.av.transcodeac3plus.value) elif getBoxType() in ('gbquad4k', 'gbue4k'): choice_list = [("downmix", _("Downmix")), ("passthrough", _("Passthrough")), ("force_ac3", _("convert to AC3")), ("multichannel", _("convert to multi-channel PCM")), ("force_dts", _("convert to DTS"))] self.settings.transcodeac3plus = ConfigSelection( choices=choice_list, default=config.av.transcodeac3plus.value) else: choice_list = [("use_hdmi_caps", _("controlled by HDMI")), ("force_ac3", _("convert to AC3"))] self.settings.transcodeac3plus = ConfigSelection( choices=choice_list, default=config.av.transcodeac3plus.value) self.settings.transcodeac3plus.addNotifier( self.setAC3plusTranscode, initial_call=False) conflist.append( getConfigListEntry(_("AC3plus transcoding"), self.settings.transcodeac3plus, None)) if SystemInfo["CanPcmMultichannel"]: if getBoxType() in ('dm900', 'dm920', 'dm7080', 'dm800'): choice_list = [ ("downmix", _("Downmix")), ("passthrough", _("Passthrough")), ("multichannel", _("convert to multi-channel PCM")), ("hdmi_best", _("use best / controlled by HDMI")) ] self.settings.pcm_multichannel = ConfigSelection( choices=choice_list, default=config.av.pcm_multichannel.value) else: self.settings.pcm_multichannel = ConfigOnOff( default=config.av.pcm_multichannel.value) self.settings.pcm_multichannel.addNotifier( self.changePCMMultichannel, initial_call=False) conflist.append( getConfigListEntry(_("PCM Multichannel"), self.settings.pcm_multichannel, None)) if SystemInfo["CanDTSHD"]: if getBoxType() in ("dm7080", "dm820"): choice_list = [("use_hdmi_caps", _("controlled by HDMI")), ("force_dts", _("convert to DTS"))] else: choice_list = [ ("downmix", _("Downmix")), ("force_dts", _("convert to DTS")), ("use_hdmi_caps", _("controlled by HDMI")), ("multichannel", _("convert to multi-channel PCM")), ("hdmi_best", _("use best / controlled by HDMI")) ] self.settings.dtshd = ConfigSelection( choices=choice_list, default=config.av.dtshd.value) self.settings.dtshd.addNotifier(self.setDTSHD, initial_call=False) conflist.append( getConfigListEntry(_("DTS HD downmix"), self.settings.dtshd, None)) if SystemInfo["CanWMAPRO"]: choice_list = [ ("downmix", _("Downmix")), ("passthrough", _("Passthrough")), ("multichannel", _("convert to multi-channel PCM")), ("hdmi_best", _("use best / controlled by HDMI")) ] self.settings.wmapro = ConfigSelection( choices=choice_list, default=config.av.wmapro.value) self.settings.wmapro.addNotifier(self.setWMAPro, initial_call=False) conflist.append( getConfigListEntry(_("WMA Pro downmix"), self.settings.wmapro, None)) if SystemInfo["CanBTAudio"]: choice_list = [("off", _("off")), ("on", _("on"))] self.settings.btaudio = ConfigSelection( choices=choice_list, default=config.av.btaudio.value) self.settings.btaudio.addNotifier(self.changeBTAudio, initial_call=False) conflist.append( getConfigListEntry(_("Enable BT Audio"), self.settings.btaudio, None)) if n > 0: self.audioChannel = service.audioChannel() 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(_("Audio Channel"), self.settings.channelmode, None)) selectedAudio = self.audioTracks.getCurrentTrack() for x in range(n): number = str(x + 1) i = audio.getTrackInfo(x) languages = i.getLanguage().split('/') description = i.getDescription() or "" selected = "" language = "" if selectedAudio == x: selected = "X" selectedidx = x cnt = 0 for lang in languages: if cnt: language += ' / ' if LanguageCodes.has_key(lang): language += _(LanguageCodes[lang][0]) else: language += lang cnt += 1 streams.append( (x, "", number, description, language, selected)) else: conflist.append(('', )) if SystemInfo["Can3DSurround"]: choice_list = [("none", _("off")), ("hdmi", _("HDMI")), ("spdif", _("SPDIF")), ("dac", _("DAC"))] self.settings.surround_3d = ConfigSelection( choices=choice_list, default=config.av.surround_3d.value) self.settings.surround_3d.addNotifier(self.change3DSurround, initial_call=False) conflist.append( getConfigListEntry(_("3D Surround"), self.settings.surround_3d, None)) if SystemInfo[ "Can3DSpeaker"] and config.av.surround_3d.value != "none": choice_list = [("center", _("center")), ("wide", _("wide")), ("extrawide", _("extra wide"))] self.settings.surround_3d_speaker = ConfigSelection( choices=choice_list, default=config.av.surround_3d_speaker.value) self.settings.surround_3d_speaker.addNotifier( self.change3DSurroundSpeaker, initial_call=False) conflist.append( getConfigListEntry(_("3D Surround Speaker Position"), self.settings.surround_3d_speaker, None)) if SystemInfo["CanAutoVolume"]: choice_list = [("none", _("off")), ("hdmi", _("HDMI")), ("spdif", _("SPDIF")), ("dac", _("DAC"))] self.settings.autovolume = ConfigSelection( choices=choice_list, default=config.av.autovolume.value) self.settings.autovolume.addNotifier(self.changeAutoVolume, initial_call=False) conflist.append( getConfigListEntry(_("Auto Volume Level"), self.settings.autovolume, None)) from Components.PluginComponent import plugins from Plugins.Plugin import PluginDescriptor if hasattr(self.infobar, "runPlugin"): class PluginCaller: def __init__(self, fnc, *args): self.fnc = fnc self.args = args def __call__(self, *args, **kwargs): self.fnc(*self.args) Plugins = [(p.name, PluginCaller(self.infobar.runPlugin, p)) for p in plugins.getPlugins( where=PluginDescriptor.WHERE_AUDIOMENU)] if len(Plugins): for x in Plugins: if x[0] != 'AudioEffect': # always make AudioEffect Blue button. conflist.append( getConfigListEntry(x[0], ConfigNothing(), x[1])) elif self.settings.menupage.value == PAGE_SUBTITLES: self.setTitle(_("Subtitle selection")) idx = 0 if (subtitlelist is not None): for x in subtitlelist: number = str(x[1]) description = "?" language = "" selected = "" if self.selectedSubtitle and x[: 4] == self.selectedSubtitle[: 4]: selected = "X" selectedidx = idx try: if x[4] != "und": if LanguageCodes.has_key(x[4]): language = _(LanguageCodes[x[4]][0]) else: language = x[4] except: language = "" if x[0] == 0: description = "DVB" number = "%x" % (x[1]) elif x[0] == 1: description = "teletext" number = "%x%02x" % (x[3] and x[3] or 8, x[2]) elif x[0] == 2: types = ("unknown", "embedded", "SSA file", "ASS file", "SRT file", "VOB file", "PGS file") try: description = types[x[2]] except: description = _("unknown") + ": %s" % x[2] number = str(int(number) + 1) streams.append( (x, "", number, description, language, selected)) idx += 1 if self.infobar.selected_subtitle and self.infobar.selected_subtitle != ( 0, 0, 0, 0) and not ".DVDPlayer'>" in ` self.infobar `: conflist.append( getConfigListEntry(_("Subtitle Quickmenu"), ConfigNothing(), None)) if len(conflist) > 0 and conflist[0][0]: self["key_red"].setBoolean(True) if len(conflist) > 1 and conflist[1][0]: self["key_green"].setBoolean(True) if len(conflist) > 2 and conflist[2][0]: self["key_yellow"].setBoolean(True) if len(conflist) > 3 and conflist[3][0]: self["key_blue"].setBoolean(True) self["config"].list = conflist self["config"].l.setList(conflist) self["streams"].list = streams self["streams"].setIndex(selectedidx)
def fillList(self, arg = None): streams = [] conflist = [] selectedidx = 0 self['key_red'].setBoolean(False) self['key_green'].setBoolean(False) self['key_yellow'].setBoolean(False) self['key_blue'].setBoolean(False) service = self.session.nav.getCurrentService() self.audioTracks = audio = service and service.audioTracks() n = audio and audio.getNumberOfTracks() or 0 subtitlelist = self.getSubtitleList() if self.settings.menupage.value == 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_ac3 = ConfigOnOff(default=config.av.downmix_ac3.value) self.settings.downmix_ac3.addNotifier(self.changeAC3Downmix, initial_call=False) conflist.append(getConfigListEntry(_('Digital downmix'), self.settings.downmix_ac3, None)) if SystemInfo['CanDownmixAAC']: self.settings.downmix_aac = ConfigOnOff(default=config.av.downmix_aac.value) self.settings.downmix_aac.addNotifier(self.changeAACDownmix, initial_call=False) conflist.append(getConfigListEntry(_('AAC downmix'), self.settings.downmix_aac, None)) if SystemInfo['CanAACTranscode']: choice_list = [('off', _('off')), ('ac3', _('AC3')), ('dts', _('DTS'))] self.settings.transcodeaac = ConfigSelection(choices=choice_list, default='off') self.settings.transcodeaac.addNotifier(self.setAACTranscode, initial_call=False) conflist.append(getConfigListEntry(_('AAC transcoding'), self.settings.transcodeaac, None)) if SystemInfo['CanPcmMultichannel']: self.settings.pcm_multichannel = ConfigOnOff(default=config.av.pcm_multichannel.value) self.settings.pcm_multichannel.addNotifier(self.changePCMMultichannel, initial_call=False) conflist.append(getConfigListEntry(_('PCM Multichannel'), self.settings.pcm_multichannel, None)) if n > 0: self.audioChannel = service.audioChannel() 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, None)) selectedAudio = self.audioTracks.getCurrentTrack() for x in range(n): number = str(x + 1) i = audio.getTrackInfo(x) languages = i.getLanguage().split('/') description = i.getDescription() or '' selected = '' language = '' if selectedAudio == x: selected = 'X' selectedidx = x cnt = 0 for lang in languages: if cnt: language += ' / ' if LanguageCodes.has_key(lang): language += _(LanguageCodes[lang][0]) else: language += lang cnt += 1 streams.append((x, '', number, description, language, selected)) else: conflist.append(('',)) if SystemInfo['Can3DSurround']: choice_list = [('none', _('off')), ('hdmi', _('HDMI')), ('spdif', _('SPDIF')), ('dac', _('DAC'))] self.settings.surround_3d = ConfigSelection(choices=choice_list, default=config.av.surround_3d.value) self.settings.surround_3d.addNotifier(self.change3DSurround, initial_call=False) conflist.append(getConfigListEntry(_('3D Surround'), self.settings.surround_3d, None)) if SystemInfo['Can3DSpeaker'] and config.av.surround_3d.value != 'none': choice_list = [('center', _('center')), ('wide', _('wide')), ('extrawide', _('extra wide'))] self.settings.surround_3d_speaker = ConfigSelection(choices=choice_list, default=config.av.surround_3d_speaker.value) self.settings.surround_3d_speaker.addNotifier(self.change3DSurroundSpeaker, initial_call=False) conflist.append(getConfigListEntry(_('3D Surround Speaker Position'), self.settings.surround_3d_speaker, None)) if SystemInfo['CanAutoVolume']: choice_list = [('none', _('off')), ('hdmi', _('HDMI')), ('spdif', _('SPDIF')), ('dac', _('DAC'))] self.settings.autovolume = ConfigSelection(choices=choice_list, default=config.av.autovolume.value) self.settings.autovolume.addNotifier(self.changeAutoVolume, initial_call=False) conflist.append(getConfigListEntry(_('Auto Volume Level'), self.settings.autovolume, None)) if SystemInfo['Canedidchecking']: choice_list = [('00000001', _('on')), ('00000000', _('off'))] self.settings.bypass_edid_checking = ConfigSelection(choices=choice_list, default=config.av.bypass_edid_checking.value) self.settings.bypass_edid_checking.addNotifier(self.changeEDIDChecking, initial_call=False) conflist.append(getConfigListEntry(_('Bypass HDMI EDID Check'), self.settings.bypass_edid_checking, None)) from Components.PluginComponent import plugins from Plugins.Plugin import PluginDescriptor if hasattr(self.infobar, 'runPlugin'): class PluginCaller: def __init__(self, fnc, *args): self.fnc = fnc self.args = args def __call__(self, *args, **kwargs): self.fnc(*self.args) Plugins = [ (p.name, PluginCaller(self.infobar.runPlugin, p)) for p in plugins.getPlugins(where=PluginDescriptor.WHERE_AUDIOMENU) ] if len(Plugins): for x in Plugins: if x[0] != 'AudioEffect': conflist.append(getConfigListEntry(x[0], ConfigNothing(), x[1])) elif self.settings.menupage.value == PAGE_SUBTITLES: self.setTitle(_('Subtitle selection')) idx = 0 for x in subtitlelist: number = str(x[1]) description = '?' language = '' selected = '' if self.selectedSubtitle and x[:4] == self.selectedSubtitle[:4]: selected = 'X' selectedidx = idx try: if x[4] != 'und': if LanguageCodes.has_key(x[4]): language = _(LanguageCodes[x[4]][0]) else: language = x[4] except: language = '' if x[0] == 0: description = 'DVB' number = '%x' % x[1] elif x[0] == 1: description = 'teletext' number = '%x%02x' % (x[3] and x[3] or 8, x[2]) elif x[0] == 2: types = ('unknown', 'embedded', 'SSA file', 'ASS file', 'SRT file', 'VOB file', 'PGS file') try: description = types[x[2]] except: description = _('unknown') + ': %s' % x[2] number = str(int(number) + 1) streams.append((x, '', number, description, language, selected)) idx += 1 if self.infobar.selected_subtitle and self.infobar.selected_subtitle != (0, 0, 0, 0) and ".DVDPlayer'>" not in `(self.infobar)`: conflist.append(getConfigListEntry(_('Subtitle Quickmenu'), ConfigNothing(), None)) if len(conflist) > 0 and conflist[0][0]: self['key_red'].setBoolean(True) if len(conflist) > 1 and conflist[1][0]: self['key_green'].setBoolean(True) if len(conflist) > 2 and conflist[2][0]: self['key_yellow'].setBoolean(True) if len(conflist) > 3 and conflist[3][0]: self['key_blue'].setBoolean(True) self['config'].list = conflist self['config'].l.setList(conflist) self['streams'].list = streams self['streams'].setIndex(selectedidx) return
def subtitleChecker(self): printl("", self, "S") try: subtitles = self.getCurrentServiceSubtitle() subtitlelist = subtitles.getSubtitleList() subtitleStreams = [] printl("subtitles: " + str(subtitles), self, "D") printl("what: " + str(subtitlelist), self, "D") if len(subtitlelist): for x in subtitlelist: number = str(x[1]) description = "?" myLanguage = _("<unknown>") selected = "" if x[4] != "und": if LanguageCodes.has_key(x[4]): myLanguage = LanguageCodes[x[4]][0] else: myLanguage = x[4] if x[0] == 0: description = "DVB" number = "%x" % (x[1]) elif x[0] == 1: description = "TTX" number = "%x%02x" % (x[3],x[2]) elif x[0] == 2: types = (_("<unknown>"), "UTF-8 text", "SSA", "AAS", ".SRT file", "VOB", "PGS (unsupported)") description = types[x[2]] subs = (x, "", number, description, myLanguage, selected) myLanguageFromPlex = self.subtitleData["languageCode"] if LanguageCodes.has_key(myLanguageFromPlex): myLanguageFromPlex = LanguageCodes[myLanguageFromPlex][0] printl("myLanguage: " + str(myLanguage) + " / myLanguageFromPlex: " + str(myLanguageFromPlex), self, "D") if myLanguageFromPlex == myLanguage: printl("we have a match ...", self, "D") self.enableSubtitleNow(subs[0]) self.subtitleWatcher.stop() else: print self.subtitleData print myLanguage raise Exception # just for debugging subtitleStreams.append((x, "", number, description, myLanguage, selected)) printl("subtitleStreams: " + str(subtitleStreams), self, "D") except Exception, e: printl("Subtitle Message: " + str(e), self, "D")
def fillList(self, arg=None): streams = [] conflist = [] selectedidx = 0 self["key_red"].setBoolean(False) self["key_green"].setBoolean(False) self["key_yellow"].setBoolean(False) self["key_blue"].setBoolean(False) subtitlelist = self.getSubtitleList() if self.settings.menupage.value == 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_ac3 = ConfigOnOff(default=config.av.downmix_ac3.value) self.settings.downmix_ac3.addNotifier(self.changeAC3Downmix, initial_call = False) conflist.append(getConfigListEntry(_("Digital downmix"), self.settings.downmix_ac3, None)) if SystemInfo["CanDownmixAAC"]: self.settings.downmix_aac = ConfigOnOff(default=config.av.downmix_aac.value) self.settings.downmix_aac.addNotifier(self.changeAACDownmix, initial_call = False) conflist.append(getConfigListEntry(_("AAC downmix"), self.settings.downmix_aac, None)) if SystemInfo["CanAACTranscode"]: choice_list = [("off", _("off")), ("ac3", _("AC3")), ("dts", _("DTS"))] self.settings.transcodeaac = ConfigSelection(choices = choice_list, default = "off") self.settings.transcodeaac.addNotifier(self.setAACTranscode, initial_call = False) conflist.append(getConfigListEntry(_("AAC transcoding"), self.settings.transcodeaac, None)) if SystemInfo["CanPcmMultichannel"]: self.settings.pcm_multichannel = ConfigOnOff(default=config.av.pcm_multichannel.value) self.settings.pcm_multichannel.addNotifier(self.changePCMMultichannel, initial_call = False) conflist.append(getConfigListEntry(_("PCM Multichannel"), self.settings.pcm_multichannel, None)) if n > 0: self.audioChannel = service.audioChannel() 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, None)) selectedAudio = self.audioTracks.getCurrentTrack() for x in range(n): number = str(x + 1) i = audio.getTrackInfo(x) languages = i.getLanguage().split('/') description = i.getDescription() or "" selected = "" language = "" if selectedAudio == x: selected = "X" selectedidx = x cnt = 0 for lang in languages: if cnt: language += ' / ' if LanguageCodes.has_key(lang): language += _(LanguageCodes[lang][0]) else: language += lang cnt += 1 streams.append((x, "", number, description, language, selected)) else: conflist.append(('',)) if SystemInfo["Can3DSurround"]: choice_list = [("none", _("off")), ("hdmi", _("HDMI")), ("spdif", _("SPDIF")), ("dac", _("DAC"))] self.settings.surround_3d = ConfigSelection(choices = choice_list, default = config.av.surround_3d.value) self.settings.surround_3d.addNotifier(self.change3DSurround, initial_call = False) conflist.append(getConfigListEntry(_("3D Surround"), self.settings.surround_3d, None)) if SystemInfo["Can3DSpeaker"] and config.av.surround_3d.value != "none": choice_list = [("center", _("center")), ("wide", _("wide")), ("extrawide", _("extra wide"))] self.settings.surround_3d_speaker = ConfigSelection(choices = choice_list, default = config.av.surround_3d_speaker.value) self.settings.surround_3d_speaker.addNotifier(self.change3DSurroundSpeaker, initial_call = False) conflist.append(getConfigListEntry(_("3D Surround Speaker Position"), self.settings.surround_3d_speaker, None)) if SystemInfo["CanAutoVolume"]: choice_list = [("none", _("off")), ("hdmi", _("HDMI")), ("spdif", _("SPDIF")), ("dac", _("DAC"))] self.settings.autovolume = ConfigSelection(choices = choice_list, default = config.av.autovolume.value) self.settings.autovolume.addNotifier(self.changeAutoVolume, initial_call = False) conflist.append(getConfigListEntry(_("Auto Volume Level"), self.settings.autovolume, None)) if SystemInfo["Canedidchecking"]: choice_list = [("00000001", _("on")), ("00000000", _("off"))] self.settings.bypass_edid_checking = ConfigSelection(choices = choice_list, default = config.av.bypass_edid_checking.value) self.settings.bypass_edid_checking.addNotifier(self.changeEDIDChecking, initial_call = False) conflist.append(getConfigListEntry(_("Bypass HDMI EDID Check"), self.settings.bypass_edid_checking, None)) from Components.PluginComponent import plugins from Plugins.Plugin import PluginDescriptor if hasattr(self.infobar, "runPlugin"): class PluginCaller: def __init__(self, fnc, *args): self.fnc = fnc self.args = args def __call__(self, *args, **kwargs): self.fnc(*self.args) Plugins = [ (p.name, PluginCaller(self.infobar.runPlugin, p)) for p in plugins.getPlugins(where = PluginDescriptor.WHERE_AUDIOMENU) ] if len(Plugins): for x in Plugins: if x[0] != 'AudioEffect': # always make AudioEffect Blue button. conflist.append(getConfigListEntry(x[0], ConfigNothing(),x[1])) elif self.settings.menupage.value == PAGE_SUBTITLES: self.setTitle(_("Subtitle selection")) idx = 0 for x in subtitlelist: number = str(x[1]) description = "?" language = "" selected = "" if self.selectedSubtitle and x[:4] == self.selectedSubtitle[:4]: selected = "X" selectedidx = idx try: if x[4] != "und": if LanguageCodes.has_key(x[4]): language = _(LanguageCodes[x[4]][0]) else: language = x[4] except: language = "" if x[0] == 0: description = "DVB" number = "%x" % (x[1]) elif x[0] == 1: description = "teletext" number = "%x%02x" %(x[3] and x[3] or 8, x[2]) elif x[0] == 2: types = ("unknown", "embedded", "SSA file", "ASS file", "SRT file", "VOB file", "PGS file") try: description = types[x[2]] except: description = _("unknown") + ": %s" % x[2] number = str(int(number) + 1) streams.append((x, "", number, description, language, selected)) idx += 1 if self.infobar.selected_subtitle and self.infobar.selected_subtitle != (0,0,0,0) and not ".DVDPlayer'>" in `self.infobar`: conflist.append(getConfigListEntry(_("Subtitle Quickmenu"), ConfigNothing(), None)) if len(conflist) > 0 and conflist[0][0]: self["key_red"].setBoolean(True) if len(conflist) > 1 and conflist[1][0]: self["key_green"].setBoolean(True) if len(conflist) > 2 and conflist[2][0]: self["key_yellow"].setBoolean(True) if len(conflist) > 3 and conflist[3][0]: self["key_blue"].setBoolean(True) self["config"].list = conflist self["config"].l.setList(conflist) self["streams"].list = streams self["streams"].setIndex(selectedidx)
def getText(self): service = self.source.service if self.type == self.AUDIO or self.type == self.AUDIO_CODEC or self.type == self.AUDIO_LANG: audio = service and service.audioTracks() if audio: try: selectedAudio = audio.getCurrentTrack() i = audio.getTrackInfo(selectedAudio) languages = i.getLanguage().split('/') description = i.getDescription().replace(" audio", "") or "" cnt = 0 language = '' for lang in languages: if cnt: language += ' / ' if LanguageCodes.has_key(lang): language += _(LanguageCodes[lang][0]) else: language += lang cnt += 1 if language == '': language = _("Unknown") if self.type == self.AUDIO: return description + ' | ' + language elif self.type == self.AUDIO_CODEC: return description else: return language except: pass return "" elif self.type == self.SUBTITLE or self.type == self.SUBTITLE_TYPE or self.type == self.SUBTITLE_LANG: subtitle = service and service.subtitle() selectedSubtitle = None enabled = False import Screens.InfoBar ######## MoviePlayer movieplayer = Screens.InfoBar.MoviePlayer.instance if movieplayer: selectedSubtitle = movieplayer.selected_subtitle enabled = movieplayer.subtitle_window.shown else: selectedSubtitle = None enabled = False ######## Infobar if not selectedSubtitle: InfoBar = Screens.InfoBar.InfoBar.instance if InfoBar: selectedSubtitle = InfoBar.selected_subtitle enabled = InfoBar.subtitle_window.shown else: selectedSubtitle = None enabled = False ######### for kodi & subssupport if not selectedSubtitle: try: from Plugins.Extensions.Kodi.plugin import KodiVideoPlayer kodi = KodiVideoPlayer.instance except: kodi = None if kodi and fileExists( "/usr/lib/enigma2/python/Plugins/Extensions/SubsSupport/plugin.pyo" ): if kodi.embeddedEnabled: selectedSubtitle = kodi.selected_subtitle enabled = kodi.subtitle_window.shown else: selectedSubtitle = kodi.getSubsPath() if selectedSubtitle: if self.type == self.SUBTITLE: return _("External") + " | " + selectedSubtitle elif self.type == self.SUBTITLE_TYPE: return _("External") else: return selectedSubtitle ############################## if selectedSubtitle and enabled: subtitlelist = subtitle and subtitle.getSubtitleList() for x in subtitlelist: if x[:4] == selectedSubtitle[:4]: language = _("Unknown") try: if x[4] != "und": if LanguageCodes.has_key(x[4]): language = _(LanguageCodes[x[4]][0]) else: language = x[4] except: pass if selectedSubtitle[0] == 0: description = "DVB" elif selectedSubtitle[0] == 1: description = _("teletext") elif selectedSubtitle[0] == 2: types = (_("unknown"), _("embedded"), _("SSA file"), _("ASS file"), _("SRT file"), _("VOB file"), _("PGS file")) try: description = types[x[2]] except: description = _("unknown") + ": %s" % x[2] if self.type == self.SUBTITLE: return description + ' | ' + language elif self.type == self.SUBTITLE_TYPE: return description else: return language return _("None")
def fillList(self, arg=None): streams = [] conflist = [] selectedidx = 0 self['key_red'].setBoolean(False) self['key_green'].setBoolean(False) self['key_yellow'].setBoolean(False) self['key_blue'].setBoolean(False) service = self.session.nav.getCurrentService() self.audioTracks = audio = service and service.audioTracks() n = audio and audio.getNumberOfTracks() or 0 subtitlelist = self.getSubtitleList() if self.settings.menupage.value == 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_ac3 = ConfigOnOff( default=config.av.downmix_ac3.value) self.settings.downmix_ac3.addNotifier(self.changeAC3Downmix, initial_call=False) conflist.append( getConfigListEntry(_('Digital downmix'), self.settings.downmix_ac3, None)) if SystemInfo['CanDownmixAAC']: self.settings.downmix_aac = ConfigOnOff( default=config.av.downmix_aac.value) self.settings.downmix_aac.addNotifier(self.changeAACDownmix, initial_call=False) conflist.append( getConfigListEntry(_('AAC downmix'), self.settings.downmix_aac, None)) if SystemInfo['CanAACTranscode']: choice_list = [('off', _('off')), ('ac3', _('AC3')), ('dts', _('DTS'))] self.settings.transcodeaac = ConfigSelection( choices=choice_list, default='off') self.settings.transcodeaac.addNotifier(self.setAACTranscode, initial_call=False) conflist.append( getConfigListEntry(_('AAC transcoding'), self.settings.transcodeaac, None)) if SystemInfo['CanPcmMultichannel']: self.settings.pcm_multichannel = ConfigOnOff( default=config.av.pcm_multichannel.value) self.settings.pcm_multichannel.addNotifier( self.changePCMMultichannel, initial_call=False) conflist.append( getConfigListEntry(_('PCM Multichannel'), self.settings.pcm_multichannel, None)) if n > 0: self.audioChannel = service.audioChannel() 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, None)) selectedAudio = self.audioTracks.getCurrentTrack() for x in range(n): number = str(x + 1) i = audio.getTrackInfo(x) languages = i.getLanguage().split('/') description = i.getDescription() or '' selected = '' language = '' if selectedAudio == x: selected = 'X' selectedidx = x cnt = 0 for lang in languages: if cnt: language += ' / ' if LanguageCodes.has_key(lang): language += _(LanguageCodes[lang][0]) else: language += lang cnt += 1 streams.append( (x, '', number, description, language, selected)) else: conflist.append(('', )) if SystemInfo['Can3DSurround']: choice_list = [('none', _('off')), ('hdmi', _('HDMI')), ('spdif', _('SPDIF')), ('dac', _('DAC'))] self.settings.surround_3d = ConfigSelection( choices=choice_list, default=config.av.surround_3d.value) self.settings.surround_3d.addNotifier(self.change3DSurround, initial_call=False) conflist.append( getConfigListEntry(_('3D Surround'), self.settings.surround_3d, None)) if SystemInfo[ 'Can3DSpeaker'] and config.av.surround_3d.value != 'none': choice_list = [('center', _('center')), ('wide', _('wide')), ('extrawide', _('extra wide'))] self.settings.surround_3d_speaker = ConfigSelection( choices=choice_list, default=config.av.surround_3d_speaker.value) self.settings.surround_3d_speaker.addNotifier( self.change3DSurroundSpeaker, initial_call=False) conflist.append( getConfigListEntry(_('3D Surround Speaker Position'), self.settings.surround_3d_speaker, None)) if SystemInfo['CanAutoVolume']: choice_list = [('none', _('off')), ('hdmi', _('HDMI')), ('spdif', _('SPDIF')), ('dac', _('DAC'))] self.settings.autovolume = ConfigSelection( choices=choice_list, default=config.av.autovolume.value) self.settings.autovolume.addNotifier(self.changeAutoVolume, initial_call=False) conflist.append( getConfigListEntry(_('Auto Volume Level'), self.settings.autovolume, None)) if SystemInfo['Canedidchecking']: choice_list = [('00000001', _('on')), ('00000000', _('off'))] self.settings.bypass_edid_checking = ConfigSelection( choices=choice_list, default=config.av.bypass_edid_checking.value) self.settings.bypass_edid_checking.addNotifier( self.changeEDIDChecking, initial_call=False) conflist.append( getConfigListEntry(_('Bypass HDMI EDID Check'), self.settings.bypass_edid_checking, None)) from Components.PluginComponent import plugins from Plugins.Plugin import PluginDescriptor if hasattr(self.infobar, 'runPlugin'): class PluginCaller: def __init__(self, fnc, *args): self.fnc = fnc self.args = args def __call__(self, *args, **kwargs): self.fnc(*self.args) Plugins = [(p.name, PluginCaller(self.infobar.runPlugin, p)) for p in plugins.getPlugins( where=PluginDescriptor.WHERE_AUDIOMENU)] if len(Plugins): for x in Plugins: if x[0] != 'AudioEffect': conflist.append( getConfigListEntry(x[0], ConfigNothing(), x[1])) elif self.settings.menupage.value == PAGE_SUBTITLES: self.setTitle(_('Subtitle selection')) idx = 0 for x in subtitlelist: number = str(x[1]) description = '?' language = '' selected = '' if self.selectedSubtitle and x[:4] == self.selectedSubtitle[:4]: selected = 'X' selectedidx = idx try: if x[4] != 'und': if LanguageCodes.has_key(x[4]): language = _(LanguageCodes[x[4]][0]) else: language = x[4] except: language = '' if x[0] == 0: description = 'DVB' number = '%x' % x[1] elif x[0] == 1: description = 'teletext' number = '%x%02x' % (x[3] and x[3] or 8, x[2]) elif x[0] == 2: types = ('unknown', 'embedded', 'SSA file', 'ASS file', 'SRT file', 'VOB file', 'PGS file') try: description = types[x[2]] except: description = _('unknown') + ': %s' % x[2] number = str(int(number) + 1) streams.append( (x, '', number, description, language, selected)) idx += 1 if self.infobar.selected_subtitle and self.infobar.selected_subtitle != ( 0, 0, 0, 0) and ".DVDPlayer'>" not in ` (self.infobar) `: conflist.append( getConfigListEntry(_('Subtitle Quickmenu'), ConfigNothing(), None)) if len(conflist) > 0 and conflist[0][0]: self['key_red'].setBoolean(True) if len(conflist) > 1 and conflist[1][0]: self['key_green'].setBoolean(True) if len(conflist) > 2 and conflist[2][0]: self['key_yellow'].setBoolean(True) if len(conflist) > 3 and conflist[3][0]: self['key_blue'].setBoolean(True) self['config'].list = conflist self['config'].l.setList(conflist) self['streams'].list = streams self['streams'].setIndex(selectedidx) return
def fillList(self, arg=None): streams = [] conflist = [] selectedidx = 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(_("Dolby Digital / DTS downmix"), self.settings.downmix)) self["key_red"].setBoolean(True) if SystemInfo["CanDownmixAAC"]: self.settings.downmix_aac = ConfigOnOff( default=config.av.downmix_aac.value) self.settings.downmix_aac.addNotifier(self.changeAACDownmix, initial_call=False) conflist.append( getConfigListEntry(_("AAC downmix"), self.settings.downmix_aac)) if n > 0: self.audioChannel = service.audioChannel() 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 + 1) i = audio.getTrackInfo(x) languages = i.getLanguage().split('/') description = i.getDescription() or _("<unknown>") selected = "" language = "" if selectedAudio == x: selected = _("Running") selectedidx = x cnt = 0 for lang in languages: if cnt: language += ' / ' if LanguageCodes.has_key(lang): language += LanguageCodes[lang][0] elif lang == "und": _("<unknown>") else: language += lang cnt += 1 streams.append( (x, "", number, description, language, selected)) else: streams = [] conflist.append(('', )) self["key_green"].setBoolean(False) if SystemInfo["CanMultiChannelPCM"]: self.settings.multichannel_pcm = ConfigOnOff( default=config.av.multichannel_pcm.value) self.settings.multichannel_pcm.addNotifier( self.changeMultiChannelPCM, initial_call=False) conflist.append( getConfigListEntry(_("Multichannel PCM"), self.settings.multichannel_pcm)) self["key_blue"].setBoolean(True) if SystemInfo["Can3DSurround"]: choicelist = [("none", _("off")), ("hdmi", _("HDMI")), ("spdif", _("SPDIF")), ("dac", _("DAC"))] self.settings.surround_3d = ConfigSelection( choices=choicelist, default=config.av.surround_3d.value) self.settings.surround_3d.addNotifier(self.change3DSurround, initial_call=False) conflist.append( getConfigListEntry(_("3D Surround"), self.settings.surround_3d)) self["key_blue"].setBoolean(True) if SystemInfo["CanSpeakerPosition"] and SystemInfo[ "Can3DSurround"] and config.av.surround_3d.value != "none": choicelist = [("center", _("center")), ("wide", _("wide")), ("extrawide", _("extrawide"))] self.settings.speaker_position = ConfigSelection( choices=choicelist, default=config.av.surround_speaker_position.value) self.settings.speaker_position.addNotifier( self.changeSpeakerPosition, initial_call=False) conflist.append( getConfigListEntry(_("Speaker position"), self.settings.speaker_position)) if SystemInfo["CanAVL"]: choicelist = [("none", _("off")), ("hdmi", _("HDMI")), ("spdif", _("SPDIF")), ("dac", _("DAC"))] self.settings.avl = ConfigSelection( choices=choicelist, default=config.av.avl.value) self.settings.avl.addNotifier(self.changeAVL, initial_call=False) conflist.append( getConfigListEntry(_("Automatic Volume Leveling (AVL)"), self.settings.avl)) edid_bypass_choicelist = [("00000000", _("off")), ("00000001", _("on"))] self.settings.edid_bypass = ConfigSelection( choices=edid_bypass_choicelist, default=config.av.bypass_edid_checking.value) self.settings.edid_bypass.addNotifier(self.changeEDIDBypass, initial_call=False) conflist.append( getConfigListEntry(_("Bypass HDMI EDID Check"), self.settings.edid_bypass)) self.settings.volume = NoSave( ConfigSlider(default=config.audio.volume.value, increment=5, limits=(0, 100))) self.settings.volume.addNotifier(self.changeVolume, initial_call=False) conflist.append( getConfigListEntry(_("Volume"), self.settings.volume)) elif self.settings.menupage.getValue() == PAGE_SUBTITLES: self.setTitle(_("Subtitle selection")) conflist.append(('', )) conflist.append(('', )) self["key_red"].setBoolean(False) self["key_green"].setBoolean(False) if self.subtitlesEnabled(): sel = self.infobar.selected_subtitle else: sel = None idx = 0 subtitlelist = self.getSubtitleList() if len(subtitlelist): for x in subtitlelist: number = str(x[1]) description = "?" language = _("<unknown>") selected = "" if sel and x == sel: selected = _("Running") selectedidx = idx if x[4] != "und": if LanguageCodes.has_key(x[4]): language = LanguageCodes[x[4]][0] else: language = x[4] if x[0] == 0: description = "DVB" number = "%x" % (x[1]) elif x[0] == 1: description = "TTX" number = "%x%02x" % (x[3], x[2]) elif x[0] == 2: types = (_("<unknown>"), "UTF-8 text", "SSA", "AAS", ".SRT file", "VOB", "PGS (unsupported)") description = types[x[2]] streams.append( (x, "", number, description, language, selected)) idx += 1 else: streams = [] conflist.append(getConfigListEntry(_("Menu"), self.settings.menupage)) from Components.PluginComponent import plugins from Plugins.Plugin import PluginDescriptor if hasattr(self.infobar, "runPlugin"): class PluginCaller: def __init__(self, fnc, *args): self.fnc = fnc self.args = args def __call__(self, *args, **kwargs): self.fnc(*self.args) Plugins = [(p.name, PluginCaller(self.infobar.runPlugin, p)) for p in plugins.getPlugins( where=PluginDescriptor.WHERE_AUDIOMENU)] if len(Plugins): self["key_blue"].setBoolean(True) conflist.append( getConfigListEntry(Plugins[0][0], ConfigNothing())) self.plugincallfunc = Plugins[0][1] if len(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["streams"].list = streams self["streams"].setIndex(selectedidx)
def fillList(self, arg=None): 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 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)) 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) selectedAudio = self.audioTracks.getCurrentTrack() for x in range(n): number = str(x) i = audio.getTrackInfo(x) languages = i.getLanguage().split('/') description = i.getDescription() or _("<unknown>") selected = "" language = "" if selectedAudio == x: selected = _("Running") selectedidx = x cnt = 0 for lang in languages: if cnt: language += ' / ' if LanguageCodes.has_key(lang): language += LanguageCodes[lang][0] elif lang == "und": _("<unknown>") else: language += lang cnt += 1 streams.append((x, "", number, description, language, selected)) else: streams = [] conflist.append(('',)) self["key_green"].setBoolean(False) elif self.settings.menupage.getValue() == PAGE_SUBTITLES: self.setTitle(_("Subtitle selection")) conflist.append(('',)) conflist.append(('',)) self["key_red"].setBoolean(False) self["key_green"].setBoolean(False) if self.subtitlesEnabled(): sel = self.infobar.selected_subtitle else: sel = None idx = 0 subtitlelist = self.getSubtitleList() if len(subtitlelist): for x in subtitlelist: number = str(x[1]) description = "?" language = _("<unknown>") selected = "" if sel and x[:4] == sel[:4]: selected = _("Running") selectedidx = idx if x[4] != "und": if LanguageCodes.has_key(x[4]): language = LanguageCodes[x[4]][0] else: language = x[4] if x[0] == 0: description = "DVB" number = "%x" % (x[1]) elif x[0] == 1: description = "TTX" number = "%x%02x" % (x[3],x[2]) elif x[0] == 2: types = ("UTF-8 text","SSA / AAS",".SRT file") description = types[x[2]] streams.append((x, "", number, description, language, selected)) idx += 1 else: streams = [] conflist.append(getConfigListEntry(_("Menu"), self.settings.menupage)) from Components.PluginComponent import plugins from Plugins.Plugin import PluginDescriptor if hasattr(self.infobar, "runPlugin"): class PluginCaller: def __init__(self, fnc, *args): self.fnc = fnc self.args = args def __call__(self, *args, **kwargs): self.fnc(*self.args) Plugins = [ (p.name, PluginCaller(self.infobar.runPlugin, p)) for p in plugins.getPlugins(where = PluginDescriptor.WHERE_AUDIOMENU) ] if len(Plugins): self["key_blue"].setBoolean(True) 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:] self["config"].list = conflist self["config"].l.setList(conflist) self["streams"].list = streams self["streams"].setIndex(selectedidx)
def fillList(self, arg=None): streams = [] conflist = [] selectedidx = 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(_("Dolby Digital / DTS downmix"), self.settings.downmix)) self["key_red"].setBoolean(True) if SystemInfo["CanDownmixAAC"]: self.settings.downmix_aac = ConfigOnOff(default=config.av.downmix_aac.value) self.settings.downmix_aac.addNotifier(self.changeAACDownmix, initial_call = False) conflist.append(getConfigListEntry(_("AAC downmix"), self.settings.downmix_aac)) if n > 0: self.audioChannel = service.audioChannel() 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 + 1) i = audio.getTrackInfo(x) languages = i.getLanguage().split('/') description = i.getDescription() or _("<unknown>") selected = "" language = "" if selectedAudio == x: selected = _("Running") selectedidx = x cnt = 0 for lang in languages: if cnt: language += ' / ' if LanguageCodes.has_key(lang): language += LanguageCodes[lang][0] elif lang == "und": _("<unknown>") else: language += lang cnt += 1 streams.append((x, "", number, description, language, selected)) else: streams = [] conflist.append(('',)) self["key_green"].setBoolean(False) if SystemInfo["CanMultiChannelPCM"]: self.settings.multichannel_pcm = ConfigOnOff(default=config.av.multichannel_pcm.value) self.settings.multichannel_pcm.addNotifier(self.changeMultiChannelPCM, initial_call = False) conflist.append(getConfigListEntry(_("Multichannel PCM"), self.settings.multichannel_pcm)) self["key_blue"].setBoolean(True) if SystemInfo["Can3DSurround"]: choicelist = [("none", _("off")), ("hdmi", _("HDMI")), ("spdif", _("SPDIF")), ("dac", _("DAC"))] self.settings.surround_3d = ConfigSelection(choices = choicelist, default = config.av.surround_3d.value) self.settings.surround_3d.addNotifier(self.change3DSurround, initial_call = False) conflist.append(getConfigListEntry(_("3D Surround"), self.settings.surround_3d)) self["key_blue"].setBoolean(True) if SystemInfo["CanSpeakerPosition"] and SystemInfo["Can3DSurround"] and config.av.surround_3d.value != "none": choicelist = [("center", _("center")), ("wide", _("wide")), ("extrawide", _("extrawide"))] self.settings.speaker_position = ConfigSelection(choices = choicelist, default = config.av.surround_speaker_position.value) self.settings.speaker_position.addNotifier(self.changeSpeakerPosition, initial_call = False) conflist.append(getConfigListEntry(_("Speaker position"), self.settings.speaker_position)) if SystemInfo["CanAVL"]: choicelist = [("none", _("off")), ("hdmi", _("HDMI")), ("spdif", _("SPDIF")), ("dac", _("DAC"))] self.settings.avl = ConfigSelection(choices = choicelist, default = config.av.avl.value) self.settings.avl.addNotifier(self.changeAVL, initial_call = False) conflist.append(getConfigListEntry(_("Automatic Volume Leveling (AVL)"), self.settings.avl)) edid_bypass_choicelist = [("00000000", _("off")), ("00000001", _("on"))] self.settings.edid_bypass = ConfigSelection(choices = edid_bypass_choicelist, default = config.av.bypass_edid_checking.value) self.settings.edid_bypass.addNotifier(self.changeEDIDBypass, initial_call = False) conflist.append(getConfigListEntry(_("Bypass HDMI EDID Check"), self.settings.edid_bypass)) self.settings.volume = NoSave(ConfigSlider(default=config.audio.volume.value, increment = 5, limits=(0,100))) self.settings.volume.addNotifier(self.changeVolume, initial_call = False) conflist.append(getConfigListEntry(_("Volume"), self.settings.volume)) elif self.settings.menupage.getValue() == PAGE_SUBTITLES: self.setTitle(_("Subtitle selection")) conflist.append(('',)) conflist.append(('',)) self["key_red"].setBoolean(False) self["key_green"].setBoolean(False) if self.subtitlesEnabled(): sel = self.infobar.selected_subtitle else: sel = None idx = 0 subtitlelist = self.getSubtitleList() if len(subtitlelist): for x in subtitlelist: number = str(x[1]) description = "?" language = _("<unknown>") selected = "" if sel and x == sel: selected = _("Running") selectedidx = idx if x[4] != "und": if LanguageCodes.has_key(x[4]): language = LanguageCodes[x[4]][0] else: language = x[4] if x[0] == 0: description = "DVB" number = "%x" % (x[1]) elif x[0] == 1: description = "TTX" number = "%x%02x" % (x[3],x[2]) elif x[0] == 2: types = (_("<unknown>"), "UTF-8 text", "SSA", "AAS", ".SRT file", "VOB", "PGS (unsupported)") description = types[x[2]] streams.append((x, "", number, description, language, selected)) idx += 1 else: streams = [] conflist.append(getConfigListEntry(_("Menu"), self.settings.menupage)) from Components.PluginComponent import plugins from Plugins.Plugin import PluginDescriptor if hasattr(self.infobar, "runPlugin"): class PluginCaller: def __init__(self, fnc, *args): self.fnc = fnc self.args = args def __call__(self, *args, **kwargs): self.fnc(*self.args) Plugins = [ (p.name, PluginCaller(self.infobar.runPlugin, p)) for p in plugins.getPlugins(where = PluginDescriptor.WHERE_AUDIOMENU) ] if len(Plugins): self["key_blue"].setBoolean(True) conflist.append(getConfigListEntry(Plugins[0][0], ConfigNothing())) self.plugincallfunc = Plugins[0][1] if len(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["streams"].list = streams self["streams"].setIndex(selectedidx)
def fillList(self, arg=None): streams = [] conflist = [] selectedidx = 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(_("Dolby Digital / DTS downmix"), self.settings.downmix)) self["key_red"].setBoolean(True) if n > 0: self.audioChannel = service.audioChannel() 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 + 1) i = audio.getTrackInfo(x) languages = i.getLanguage().split('/') description = i.getDescription() or _("<unknown>") selected = "" language = "" if selectedAudio == x: selected = _("Running") selectedidx = x cnt = 0 for lang in languages: if cnt: language += ' / ' if LanguageCodes.has_key(lang): language += LanguageCodes[lang][0] elif lang == "und": _("<unknown>") else: language += lang cnt += 1 streams.append( (x, "", number, description, language, selected)) else: streams = [] conflist.append(('', )) self["key_green"].setBoolean(False) elif self.settings.menupage.getValue() == PAGE_SUBTITLES: self.setTitle(_("Subtitle selection")) conflist.append(('', )) self["key_red"].setBoolean(False) if self.infobar.selected_subtitle: conflist.append( getConfigListEntry(_("Subtitle Quickmenu"), ConfigNothing())) self["key_green"].setBoolean(True) else: conflist.append(('', )) self["key_green"].setBoolean(False) if self.subtitlesEnabled(): sel = self.infobar.selected_subtitle else: sel = None idx = 0 subtitlelist = self.getSubtitleList() if len(subtitlelist): for x in subtitlelist: number = str(x[1]) description = "?" language = _("<unknown>") selected = "" if sel and x == sel: selected = _("Running") selectedidx = idx if x[4] != "und": if LanguageCodes.has_key(x[4]): language = LanguageCodes[x[4]][0] else: language = x[4] if x[0] == 0: description = "DVB" number = "%x" % (x[1]) elif x[0] == 1: description = "TTX" number = "%x%02x" % (x[3], x[2]) elif x[0] == 2: types = (_("<unknown>"), "UTF-8 text", "SSA", "AAS", ".SRT file", "VOB", "PGS (unsupported)") description = types[x[2]] streams.append( (x, "", number, description, language, selected)) idx += 1 else: streams = [] conflist.append(getConfigListEntry(_("Menu"), self.settings.menupage)) from Components.PluginComponent import plugins from Plugins.Plugin import PluginDescriptor if hasattr(self.infobar, "runPlugin"): class PluginCaller: def __init__(self, fnc, *args): self.fnc = fnc self.args = args def __call__(self, *args, **kwargs): self.fnc(*self.args) Plugins = [(p.name, PluginCaller(self.infobar.runPlugin, p)) for p in plugins.getPlugins( where=PluginDescriptor.WHERE_AUDIOMENU)] if len(Plugins): self["key_blue"].setBoolean(True) conflist.append( getConfigListEntry(Plugins[0][0], ConfigNothing())) self.plugincallfunc = Plugins[0][1] if len(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["streams"].list = streams self["streams"].setIndex(selectedidx)
def fillList(self, arg=None): streams = [] conflist = [] selectedidx = 0 # self["key_blue"].setBoolean(False) subtitlelist = self.getSubtitleList() self.nummplugin = None #### modify this section for add audio functions if self.settings.menupage.getValue() == PAGE_AUDIO: self.setTitle(_("Select audio track")) self["key_yellow"].setBoolean(True) self["key_green"].setBoolean(True) self["key_red"].setBoolean(True) 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_ac3 = ConfigOnOff( default=config.av.downmix_ac3.getValue()) self.settings.downmix_ac3.addNotifier(self.changeAC3Downmix, initial_call=False) conflist.append( getConfigListEntry(_("AC3 downmix"), self.settings.downmix_ac3)) if SystemInfo["CanDownmixDTS"]: self.settings.downmix_dts = ConfigOnOff( default=config.av.downmix_dts.value) self.settings.downmix_dts.addNotifier(self.changeDTSDownmix, initial_call=False) conflist.append( getConfigListEntry(_("DTS downmix"), self.settings.downmix_dts, None)) if SystemInfo["CanDownmixAAC"]: self.settings.downmix_aac = ConfigOnOff( default=config.av.downmix_aac.getValue()) self.settings.downmix_aac.addNotifier(self.changeAACDownmix, initial_call=False) conflist.append( getConfigListEntry(_("AAC downmix"), self.settings.downmix_aac)) if SystemInfo["CanAACTranscode"]: choice_list = [("off", _("off")), ("ac3", _("AC3")), ("dts", _("DTS"))] self.settings.transcodeaac = ConfigSelection( choices=choice_list, default="off") self.settings.transcodeaac.addNotifier(self.setAACTranscode, initial_call=False) conflist.append( getConfigListEntry(_("AAC transcoding"), self.settings.transcodeaac, None)) if SystemInfo["CanAC3plusTranscode"]: choice_list = [("use_hdmi_caps", _("controlled by HDMI")), ("force_ac3", _("always"))] self.settings.transcodeac3plus = ConfigSelection( choices=choice_list, default="use_hdmi_caps") self.settings.transcodeac3plus.addNotifier( self.setAC3plusTranscode, initial_call=False) conflist.append( getConfigListEntry(_("AC3plus transcoding"), self.settings.transcodeac3plus, None)) if SystemInfo["CanPcmMultichannel"]: self.settings.pcm_multichannel = ConfigOnOff( default=config.av.pcm_multichannel.getValue()) self.settings.pcm_multichannel.addNotifier( self.changePCMMultichannel, initial_call=False) conflist.append( getConfigListEntry(_("PCM Multichannel"), self.settings.pcm_multichannel, None)) if n > 0: self.audioChannel = service.audioChannel() 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(_("Audio Channel"), self.settings.channelmode)) else: conflist.append(getConfigListEntry("", ConfigNothing())) # self["key_green"].setBoolean(False) selectedAudio = self.audioTracks.getCurrentTrack() conta = 0 for x in range(n): number = str(conta + 1) i = audio.getTrackInfo(x) languages = i.getLanguage().split('/') description = i.getDescription() or "" pondebug("AUDIO " + str(conta) + " - " + str(languages) + " - " + str(description)) selected = "" language = "" if selectedAudio == x: selected = "X" selectedidx = x cnt = 0 for lang in languages: if cnt: language += ' / ' if lang.lower() == "und": language += _("Language") + " " + number + "" elif lang.lower() == "qaa": language += _("Original track audio") + "" elif LanguageCodes.has_key(lang): templan = str(LanguageCodes[lang][0]) if templan == None or templan == "": language += _( "Language") + " " + number + " (" + str( lang) + ")" else: language += _(templan) else: if lang == None or lang == "": language += _( "Language") + " [" + number + "] " + str( lang) + "" else: language += _( "Language") + " [" + number + "] " + str( lang) + "" cnt += 1 if language != "---": try: streams.append((x, "", number, language, description, selected)) conta += 1 except: pass else: streams = [] conflist.append(getConfigListEntry("", ConfigNothing())) # self["key_green"].setBoolean(False) #add by mpiero try: self["key_info"].setText(_("To subtitle selection")) except: pass if subtitlelist: # self["key_yellow"].setBoolean(True) # conflist.append(getConfigListEntry(_("To subtitle selection"), self.settings.menupage)) pass else: # self["key_yellow"].setBoolean(False) conflist.append(getConfigListEntry("", ConfigNothing())) if SystemInfo["Can3DSurround"]: surround_choicelist = [("none", _("off")), ("hdmi", _("HDMI")), ("spdif", _("SPDIF")), ("dac", _("DAC"))] self.settings.surround_3d = ConfigSelection( choices=surround_choicelist, default=config.av.surround_3d.getValue()) self.settings.surround_3d.addNotifier(self.change3DSurround, initial_call=False) conflist.append( getConfigListEntry(_("3D Surround"), self.settings.surround_3d)) from Components.PluginComponent import plugins from Plugins.Plugin import PluginDescriptor if hasattr(self.infobar, "runPlugin"): class PluginCaller: def __init__(self, fnc, *args): self.fnc = fnc self.args = args def __call__(self, *args, **kwargs): self.fnc(*self.args) Plugins = [(p.name, PluginCaller(self.infobar.runPlugin, p)) for p in plugins.getPlugins( where=PluginDescriptor.WHERE_AUDIOMENU)] if len(Plugins): #add by mpiero # self["key_blue"].setBoolean(True) conflist.append( getConfigListEntry(Plugins[0][0], ConfigNothing())) self.plugincallfunc = Plugins[0][1] self.nummplugin = len(conflist) - 1 if len(Plugins) > 1: print "plugin(s) installed but not displayed in the dialog box:", Plugins[ 1:] #### modify this section for add subtitle functions elif self.settings.menupage.getValue() == PAGE_SUBTITLES: self.setTitle(_("Subtitle selection")) # conflist.append(getConfigListEntry("----", ConfigNothing())) # conflist.append(getConfigListEntry("----", ConfigNothing())) self["key_yellow"].setBoolean(False) self["key_green"].setBoolean(False) self["key_red"].setBoolean(False) selected = "X" for x in subtitlelist: if self.selectedSubtitle and x[:4] == self.selectedSubtitle[:4]: selected = "" streams.append(("Ninguno", "", "1", "(" + _("Deactivate") + ")", "" + _("No subtitles"), selected)) idx = 1 selectedidx = 0 for x in subtitlelist: pondebug("SUBTITLES " + str(idx) + " - " + str(x)) number = str(x[1]) description = "?" language = "" selected = "" if self.selectedSubtitle and x[:4] == self.selectedSubtitle[:4]: selected = "X" selectedidx = idx try: if x[4].lower() == "und": language += _("Language") + " " + str(idx + 1) + "" elif x[4].lower() == "qaa": language += _("Original track audio") + "" elif LanguageCodes.has_key(x[4]): language = _(LanguageCodes[x[4]][0]) else: language = _("Language") + " " + str(idx + 1) + " (" + str( x[4]) + ")" except: language = "" if x[0] == 0: description = _("Digital Subtitle") + "(DVB)" number = "%x" % (x[1]) elif x[0] == 1: description = _("Teletext Subtitle") + "(TXT)" number = "%x%02x" % (x[3] and x[3] or 8, x[2]) elif x[0] == 2: types = (_("unknown"), "embedded", _("File") + " " + "SSA", _("File") + " " + "ASS", _("File") + " " + "SRT", _("File") + " " + "VOB", _("File") + " " + "PGS") try: description = types[x[2]] except: description = _("unknown") + ": %s" % x[2] number = str(int(number) + 1) if language == None or language == "": pass else: streams.append( (x, "", str(idx + 1), language, description, selected)) idx += 1 # conflist.append(getConfigListEntry(_("To audio selection"), self.settings.menupage)) try: self["key_info"].setText(_("To audio selection")) except: pass if self.infobar.selected_subtitle and self.infobar.selected_subtitle != ( 0, 0, 0, 0) and not ".DVDPlayer'>" in ` self.infobar `: self["key_red"].setBoolean(True) conflist.append( getConfigListEntry(_("Subtitle Quickmenu"), ConfigNothing())) # else: # conflist.append(getConfigListEntry("----", ConfigNothing())) self["config"].list = conflist self["config"].l.setList(conflist) self["streams"].list = streams self["streams"].setIndex(selectedidx)
def fillList(self, preselected_idx=None): streams = [] conflist = [] playing_idx = None 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)) self["key_red"].setBoolean(True) if n > 0: self.audioChannel = service.audioChannel() 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) playing_idx = self.audioTracks.getCurrentTrack() for idx in range(n): s_number = str(idx + 1) trackinfo = audio.getTrackInfo(idx) languages = trackinfo.getLanguage().split('/') s_codec = AUDIO_FORMATS[trackinfo.getType()][1] s_description = trackinfo.getDescription() or "" s_language = "" selected = idx == playing_idx if selected: playing_idx = idx cnt = 0 for lang in languages: if cnt: s_language += ' / ' if LanguageCodes.has_key(lang): s_language += _(LanguageCodes[lang][0]) elif lang == "und": _("<unknown>") else: s_language += lang cnt += 1 streams.append((SelectionTrackinfoEntry(idx, trackinfo), s_number, s_language, s_codec, s_description, selected and selectionpng or None)) else: streams = [] conflist.append(('',)) self["key_green"].setBoolean(False) elif self.settings.menupage.getValue() == PAGE_SUBTITLES: self.setTitle(_("Subtitle selection")) conflist.append(('',)) conflist.append(('',)) self["key_red"].setBoolean(False) self["key_green"].setBoolean(False) if self.infobar.subtitles_enabled: playing_idx = self.infobar.selected_subtitle else: playing_idx = None subs = self.infobar.getCurrentServiceSubtitle() n = subs and subs.getNumberOfSubtitleTracks() or 0 for idx in range(n): trackinfo = subs.getSubtitleTrackInfo(idx) s_number = str(idx + 1) s_codec = "?" s_language = _("<unknown>") flags = [] selected = idx == playing_idx if selected: playing_idx = idx lang = trackinfo.getLanguage() if lang != "und": if LanguageCodes.has_key(lang): s_language = _(LanguageCodes[lang][0]) else: s_language = lang if trackinfo.getType() == iSt.GST: s_codec = GST_SUB_FORMATS[trackinfo.getGstSubtype()][1] else: s_codec = SUB_FORMATS[trackinfo.getType()][1] if trackinfo.getType() in [iSt.GST, iSt.DVD]: if trackinfo.isDefault(): flags.append(_("Default")) if trackinfo.isForced(): flags.append(_("Forced")) if trackinfo.getType() == iSt.DVD or trackinfo.getGstSubtype() in [iGSt.stPGS, iGSt.stVOB]: if trackinfo.getFilter() & iSubtitleFilterType_ENUMS.SUB_FILTER_SHOW_FORCED_ONLY: flags.append(_("forced only")) if trackinfo.getFilter() & iSubtitleFilterType_ENUMS.SUB_FILTER_SHOW_ALL: flags.append(_("show all")) if trackinfo.isSaved(): flags.append(_("Saved")) s_flags = (", ").join(flags) if s_codec == "TTX": s_codec += " %x%x" %(trackinfo.getMagazineNumber(), trackinfo.getPageNumber()) stream = (SelectionTrackinfoEntry(idx, trackinfo), s_number, s_language, s_codec, s_flags, selected and selectionpng or None) streams.append(stream) conflist.append(getConfigListEntry(_("Menu"), self.settings.menupage)) if hasattr(self.infobar, "runPlugin"): class PluginCaller: def __init__(self, fnc, *args): self.fnc = fnc self.args = args def __call__(self, *args, **kwargs): self.fnc(*self.args) audioPlugins = [ (p.name, PluginCaller(self.infobar.runPlugin, p)) for p in plugins.getPlugins(where = PluginDescriptor.WHERE_AUDIOMENU) ] if len(audioPlugins) > 0: self["key_blue"].setBoolean(True) text, fnc = audioPlugins[0] conflist.append(getConfigListEntry(text, ConfigNothing())) self.plugincallerdict[text] = fnc if len(audioPlugins) > 1: self["key_menu"].setBoolean(True) if len(audioPlugins) == 2: text, fnc = audioPlugins[1] self.plugincallerdict[text] = fnc conflist.append(getConfigListEntry(text, ConfigNothing())) else: self._extendedAudioPlugins = audioPlugins[1:] text, fnc = _("More ..."), self.showExtendedAudioPluginChoice audioPlugins.append([text, fnc]) conflist.append(getConfigListEntry(text, ConfigNothing())) self.plugincallerdict[text] = fnc for text, fnc in audioPlugins[1:]: self.plugincallerdict[text] = fnc self["config"].list = conflist self["config"].l.setList(conflist) self["streams"].list = streams if isinstance(preselected_idx, int): self["streams"].setIndex(preselected_idx) elif isinstance(playing_idx, int): self["streams"].setIndex(playing_idx) self.setToggleSubsFilterKey()
def fillList(self, preselected_idx=None): streams = [] conflist = [] playing_idx = None 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)) self["key_red"].setBoolean(True) if n > 0: self.audioChannel = service.audioChannel() 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) playing_idx = self.audioTracks.getCurrentTrack() for idx in range(n): s_number = str(idx + 1) trackinfo = audio.getTrackInfo(idx) languages = trackinfo.getLanguage().split('/') s_codec = AUDIO_FORMATS[trackinfo.getType()][1] s_description = trackinfo.getDescription() or "" s_language = "" selected = idx == playing_idx if selected: playing_idx = idx cnt = 0 for lang in languages: if cnt: s_language += ' / ' if LanguageCodes.has_key(lang): s_language += _(LanguageCodes[lang][0]) elif lang == "und": _("<unknown>") else: s_language += lang cnt += 1 streams.append((SelectionTrackinfoEntry(idx, trackinfo), s_number, s_language, s_codec, s_description, selected and selectionpng or None)) else: streams = [] conflist.append(('',)) self["key_green"].setBoolean(False) elif self.settings.menupage.getValue() == PAGE_SUBTITLES: self.setTitle(_("Subtitle selection")) conflist.append(('',)) conflist.append(('',)) self["key_red"].setBoolean(False) self["key_green"].setBoolean(False) if self.infobar.subtitles_enabled: playing_idx = self.infobar.selected_subtitle else: playing_idx = None subs = self.infobar.getCurrentServiceSubtitle() n = subs and subs.getNumberOfSubtitleTracks() or 0 for idx in range(n): trackinfo = subs.getSubtitleTrackInfo(idx) s_number = str(idx + 1) s_codec = "?" s_language = _("<unknown>") flags = [] selected = idx == playing_idx if selected: playing_idx = idx lang = trackinfo.getLanguage() if lang != "und": if LanguageCodes.has_key(lang): s_language = _(LanguageCodes[lang][0]) else: s_language = lang if trackinfo.getType() == iSt.GST: s_codec = GST_SUB_FORMATS[trackinfo.getGstSubtype()][1] else: s_codec = SUB_FORMATS[trackinfo.getType()][1] if trackinfo.getType() in [iSt.GST, iSt.DVD]: if trackinfo.isDefault(): flags.append(_("Default")) if trackinfo.isForced(): flags.append(_("Forced")) if trackinfo.getType() == iSt.DVD or trackinfo.getGstSubtype() in [iGSt.stPGS, iGSt.stVOB]: if trackinfo.getFilter() & iSubtitleFilterType_ENUMS.SUB_FILTER_SHOW_FORCED_ONLY: flags.append(_("forced only")) if trackinfo.getFilter() & iSubtitleFilterType_ENUMS.SUB_FILTER_SHOW_ALL: flags.append(_("show all")) if trackinfo.isSaved(): flags.append(_("Saved")) s_flags = (", ").join(flags) stream = (SelectionTrackinfoEntry(idx, trackinfo), s_number, s_language, s_codec, s_flags, selected and selectionpng or None) streams.append(stream) conflist.append(getConfigListEntry(_("Menu"), self.settings.menupage)) if hasattr(self.infobar, "runPlugin"): class PluginCaller: def __init__(self, fnc, *args): self.fnc = fnc self.args = args def __call__(self, *args, **kwargs): self.fnc(*self.args) Plugins = [ (p.name, PluginCaller(self.infobar.runPlugin, p)) for p in plugins.getPlugins(where = PluginDescriptor.WHERE_AUDIOMENU) ] if len(Plugins) > 0: self["key_blue"].setBoolean(True) conflist.append(getConfigListEntry(Plugins[0][0], ConfigNothing())) self.plugincallerdict[Plugins[0][0]] = Plugins[0][1] if len(Plugins) > 1: self["key_menu"].setBoolean(True) conflist.append(getConfigListEntry(Plugins[1][0], ConfigNothing())) self.plugincallerdict[Plugins[1][0]] = Plugins[1][1] if len(Plugins) > 2: print "[AudioSelection] plugin(s) installed but not displayed in the dialog box:", Plugins[2:] #fixme display choicebox self["config"].list = conflist self["config"].l.setList(conflist) self["streams"].list = streams if isinstance(preselected_idx, int): self["streams"].setIndex(preselected_idx) elif isinstance(playing_idx, int): self["streams"].setIndex(playing_idx) self.setToggleSubsFilterKey()
def getText(self): service = self.source.service if self.type == self.AUDIO or self.type == self.AUDIO_CODEC or self.type == self.AUDIO_LANG: audio = service and service.audioTracks() if audio: try: selectedAudio = audio.getCurrentTrack() i = audio.getTrackInfo(selectedAudio) languages = i.getLanguage().split('/') description = i.getDescription().replace(' audio', '') or '' cnt = 0 language = '' for lang in languages: if cnt: language += ' / ' if LanguageCodes.has_key(lang): language += _(LanguageCodes[lang][0]) else: language += lang cnt += 1 if language == '': language = _('Unknown') if self.type == self.AUDIO: return description + ' | ' + language if self.type == self.AUDIO_CODEC: return description return language except: pass return '' if self.type == self.SUBTITLE or self.type == self.SUBTITLE_TYPE or self.type == self.SUBTITLE_LANG: subtitle = service and service.subtitle() selectedSubtitle = None enabled = False import Screens.InfoBar movieplayer = Screens.InfoBar.MoviePlayer.instance if movieplayer: selectedSubtitle = movieplayer.selected_subtitle enabled = movieplayer.subtitle_window.shown else: selectedSubtitle = None enabled = False if not selectedSubtitle: InfoBar = Screens.InfoBar.InfoBar.instance if InfoBar: selectedSubtitle = InfoBar.selected_subtitle enabled = InfoBar.subtitle_window.shown else: selectedSubtitle = None enabled = False if not selectedSubtitle: try: from Plugins.Extensions.Kodi.plugin import KodiVideoPlayer kodi = KodiVideoPlayer.instance except: kodi = None if kodi: if kodi.embeddedEnabled: selectedSubtitle = kodi.selected_subtitle enabled = kodi.subtitle_window.shown else: selectedSubtitle = kodi.getSubsPath() if selectedSubtitle: if self.type == self.SUBTITLE: return _('External') + ' | ' + selectedSubtitle elif self.type == self.SUBTITLE_TYPE: return _('External') else: return selectedSubtitle if selectedSubtitle and enabled: subtitlelist = subtitle and subtitle.getSubtitleList() for x in subtitlelist: if x[:4] == selectedSubtitle[:4]: language = _('Unknown') try: if x[4] != 'und': if LanguageCodes.has_key(x[4]): language = _(LanguageCodes[x[4]][0]) else: language = x[4] except: pass if selectedSubtitle[0] == 0: description = 'DVB' elif selectedSubtitle[0] == 1: description = _('teletext') elif selectedSubtitle[0] == 2: types = (_('unknown'), _('embedded'), _('SSA file'), _('ASS file'), _('SRT file'), _('VOB file'), _('PGS file')) try: description = types[x[2]] except: description = _('unknown') + ': %s' % x[2] if self.type == self.SUBTITLE: return description + ' | ' + language elif self.type == self.SUBTITLE_TYPE: return description else: return language return _('None')
def fillList(self, arg=None): streams = [] conflist = [] selectedidx = 0 self["key_blue"].setBoolean(False) subtitlelist = self.getSubtitleList() 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(_("Multi channel downmix"), self.settings.downmix)) self["key_red"].setBoolean(True) if n > 0: self.audioChannel = service.audioChannel() 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 + 1) i = audio.getTrackInfo(x) languages = i.getLanguage().split('/') description = i.getDescription() or "" selected = "" language = "" if selectedAudio == x: selected = "X" selectedidx = x cnt = 0 for lang in languages: if cnt: language += ' / ' if LanguageCodes.has_key(lang): language += _(LanguageCodes[lang][0]) elif lang == "und": "" else: language += lang cnt += 1 streams.append((x, "", number, description, language, selected)) else: streams = [] conflist.append(('',)) self["key_green"].setBoolean(False) if subtitlelist: self["key_yellow"].setBoolean(True) conflist.append(getConfigListEntry(_("To subtitle selection"), self.settings.menupage)) else: self["key_yellow"].setBoolean(False) conflist.append(('',)) from Components.PluginComponent import plugins from Plugins.Plugin import PluginDescriptor if hasattr(self.infobar, "runPlugin"): class PluginCaller: def __init__(self, fnc, *args): self.fnc = fnc self.args = args def __call__(self, *args, **kwargs): self.fnc(*self.args) self.Plugins = [ (p.name, PluginCaller(self.infobar.runPlugin, p)) for p in plugins.getPlugins(where = PluginDescriptor.WHERE_AUDIOMENU) ] if self.Plugins: self["key_blue"].setBoolean(True) if len(self.Plugins) > 1: conflist.append(getConfigListEntry(_("Audio plugins"), ConfigNothing())) self.plugincallfunc = [(x[0], x[1]) for x in self.Plugins] else: conflist.append(getConfigListEntry(self.Plugins[0][0], ConfigNothing())) self.plugincallfunc = self.Plugins[0][1] elif self.settings.menupage.getValue() == PAGE_SUBTITLES: self.setTitle(_("Subtitle selection")) conflist.append(('',)) conflist.append(('',)) self["key_red"].setBoolean(False) self["key_green"].setBoolean(False) idx = 0 for x in subtitlelist: number = str(x[1]) description = "?" language = "" selected = "" if self.selectedSubtitle and x[:4] == self.selectedSubtitle[:4]: selected = "X" selectedidx = idx try: if x[4] != "und": if LanguageCodes.has_key(x[4]): language = _(LanguageCodes[x[4]][0]) else: language = x[4] except: language = "" if x[0] == 0: description = "DVB" number = "%x" % (x[1]) elif x[0] == 1: description = "teletext" number = "%x%02x" %(x[3] and x[3] or 8, x[2]) elif x[0] == 2: types = ("unknown", "embedded", "SSA file", "ASS file", "SRT file", "VOB file", "PGS file") try: description = types[x[2]] except: description = _("unknown") + ": %s" % x[2] number = str(int(number) + 1) streams.append((x, "", number, description, language, selected)) idx += 1 conflist.append(getConfigListEntry(_("To audio selection"), self.settings.menupage)) if self.infobar.selected_subtitle and self.infobar.selected_subtitle != (0,0,0,0) and not ".DVDPlayer'>" in `self.infobar`: self["key_blue"].setBoolean(True) conflist.append(getConfigListEntry(_("Subtitle Quickmenu"), ConfigNothing())) self["config"].list = conflist self["config"].l.setList(conflist) self["streams"].list = streams self["streams"].setIndex(selectedidx)
def fillList(self, arg=None): streams = [] conflist = [] selectedidx = 0 # self["key_blue"].setBoolean(False) service = self.session.nav.getCurrentService() self.audioTracks = audio = service and service.audioTracks() n = audio and audio.getNumberOfTracks() or 0 subtitlelist = self.getSubtitleList() self.nummplugin=None #### modify this section for add audio functions if self.settings.menupage.getValue() == PAGE_AUDIO: self.setTitle(_("Select audio track")) self["key_yellow"].setBoolean(True) self["key_green"].setBoolean(True) self["key_red"].setBoolean(True) 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_ac3 = ConfigOnOff(default=config.av.downmix_ac3.getValue()) self.settings.downmix_ac3.addNotifier(self.changeAC3Downmix, initial_call = False) conflist.append(getConfigListEntry(_("AC3 downmix"), self.settings.downmix_ac3)) if SystemInfo["CanDownmixAAC"]: self.settings.downmix_aac = ConfigOnOff(default=config.av.downmix_aac.getValue()) self.settings.downmix_aac.addNotifier(self.changeAACDownmix, initial_call = False) conflist.append(getConfigListEntry(_("AAC downmix"), self.settings.downmix_aac)) if SystemInfo["Can3DSurround"]: surround_choicelist = [("none", _("off")), ("hdmi", _("HDMI")), ("spdif", _("SPDIF")), ("dac", _("DAC"))] self.settings.surround_3d = ConfigSelection(choices = surround_choicelist, default = config.av.surround_3d.getValue()) self.settings.surround_3d.addNotifier(self.change3DSurround, initial_call = False) conflist.append(getConfigListEntry(_("3D Surround"), self.settings.surround_3d)) if SystemInfo["CanPcmMultichannel"]: self.settings.pcm_multichannel = ConfigOnOff(default=config.av.pcm_multichannel.getValue()) self.settings.pcm_multichannel.addNotifier(self.changePCMMultichannel, initial_call = False) conflist.append(getConfigListEntry(_("PCM Multichannel"), self.settings.pcm_multichannel, None)) if SystemInfo["Canedidchecking"]: edid_bypass_choicelist = [("00000001", _("on")), ("00000000", _("off"))] self.settings.edid_bypass = ConfigSelection(choices = edid_bypass_choicelist, default = config.av.bypass_edid_checking.getValue()) self.settings.edid_bypass.addNotifier(self.changeEDIDBypass, initial_call = False) conflist.append(getConfigListEntry(_("Bypass HDMI EDID Check"), self.settings.edid_bypass)) if n > 0: self.audioChannel = service.audioChannel() 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)) else: conflist.append(getConfigListEntry("", ConfigNothing())) # self["key_green"].setBoolean(False) selectedAudio = self.audioTracks.getCurrentTrack() conta=0 for x in range(n): number = str(conta + 1) i = audio.getTrackInfo(x) languages = i.getLanguage().split('/') description = i.getDescription() or "" pondebug("AUDIO "+str(conta)+" - "+str(languages)+" - "+str(description)) selected = "" language = "" if selectedAudio == x: selected = "X" selectedidx = x cnt = 0 for lang in languages: if cnt: language += ' / ' if lang.lower() == "und": language +=_("Language")+" "+number+"" elif lang.lower() == "qaa": language +=_("Original track audio")+"" elif LanguageCodes.has_key(lang): templan=str(LanguageCodes[lang][0]) if templan==None or templan=="": language +=_("Language")+" "+number+" ("+str(lang)+")" else: language += _(templan) else: if lang==None or lang=="": language += _("Language")+" ["+number+"] "+str(lang)+"" else: language += _("Language")+" ["+number+"] "+str(lang)+"" cnt += 1 if language!="---": try: streams.append((x, "", number, language,description, selected)) conta+=1 except: pass else: streams = [] conflist.append(getConfigListEntry("", ConfigNothing())) # self["key_green"].setBoolean(False) #add by mpiero try: self["key_info"].setText(_("To subtitle selection")) except: pass if subtitlelist: # self["key_yellow"].setBoolean(True) # conflist.append(getConfigListEntry(_("To subtitle selection"), self.settings.menupage)) pass else: # self["key_yellow"].setBoolean(False) conflist.append(getConfigListEntry("", ConfigNothing())) from Components.PluginComponent import plugins from Plugins.Plugin import PluginDescriptor if hasattr(self.infobar, "runPlugin"): class PluginCaller: def __init__(self, fnc, *args): self.fnc = fnc self.args = args def __call__(self, *args, **kwargs): self.fnc(*self.args) Plugins = [ (p.name, PluginCaller(self.infobar.runPlugin, p)) for p in plugins.getPlugins(where = PluginDescriptor.WHERE_AUDIOMENU) ] if len(Plugins): #add by mpiero # self["key_blue"].setBoolean(True) conflist.append(getConfigListEntry(Plugins[0][0], ConfigNothing())) self.plugincallfunc = Plugins[0][1] self.nummplugin=len(conflist)-1 if len(Plugins) > 1: print "plugin(s) installed but not displayed in the dialog box:", Plugins[1:] #### modify this section for add subtitle functions elif self.settings.menupage.getValue() == PAGE_SUBTITLES: self.setTitle(_("Subtitle selection")) # conflist.append(getConfigListEntry("----", ConfigNothing())) # conflist.append(getConfigListEntry("----", ConfigNothing())) self["key_yellow"].setBoolean(False) self["key_green"].setBoolean(False) self["key_red"].setBoolean(False) selected="X" for x in subtitlelist: if self.selectedSubtitle and x[:4] == self.selectedSubtitle[:4]: selected = "" streams.append(("Ninguno", "", "1", "("+_("Deactivate")+")",""+_("No subtitles"), selected)) idx = 1 selectedidx=0 for x in subtitlelist: pondebug("SUBTITLES "+str(idx)+" - "+str(x)) number = str(x[1]) description = "?" language = "" selected = "" if self.selectedSubtitle and x[:4] == self.selectedSubtitle[:4]: selected = "X" selectedidx = idx try: if x[4].lower()=="und": language +=_("Language")+" "+str(idx+1)+"" elif x[4].lower() == "qaa": language +=_("Original track audio")+"" elif LanguageCodes.has_key(x[4]): language = _(LanguageCodes[x[4]][0]) else: language =_("Language")+" "+str(idx+1)+" ("+str(x[4])+")" except: language = "" if x[0] == 0: description = _("Digital Subtitle")+"(DVB)" number = "%x" % (x[1]) elif x[0] == 1: description = _("Teletext Subtitle")+"(TXT)" number = "%x%02x" %(x[3] and x[3] or 8, x[2]) elif x[0] == 2: types = (_("unknown"), "embedded", _("File")+" "+"SSA", _("File")+" "+"ASS", _("File")+" "+"SRT", _("File")+" "+"VOB", _("File")+" "+"PGS") try: description = types[x[2]] except: description = _("unknown") + ": %s" % x[2] number = str(int(number) + 1) if language==None or language=="": pass else: streams.append((x, "", str(idx+1), language,description , selected)) idx += 1 # conflist.append(getConfigListEntry(_("To audio selection"), self.settings.menupage)) try: self["key_info"].setText(_("To audio selection")) except: pass if self.infobar.selected_subtitle and self.infobar.selected_subtitle != (0,0,0,0) and not ".DVDPlayer'>" in `self.infobar`: self["key_red"].setBoolean(True) conflist.append(getConfigListEntry(_("Subtitle Quickmenu"), ConfigNothing())) # else: # conflist.append(getConfigListEntry("----", ConfigNothing())) self["config"].list = conflist self["config"].l.setList(conflist) self["streams"].list = streams self["streams"].setIndex(selectedidx)