diff options
| author | Fraxinas <andreas.frisch@multimedia-labs.de> | 2008-11-13 13:01:17 +0100 |
|---|---|---|
| committer | Fraxinas <andreas.frisch@multimedia-labs.de> | 2008-11-13 13:01:17 +0100 |
| commit | 100681320b09e764b447b00a22cb3ee53d15edf7 (patch) | |
| tree | 08caed88f758c5fa5216ae55b8e5d4d28eda9580 /lib/python/Plugins/Extensions/DVDBurn/TitleProperties.py | |
| parent | 4946a987277adbbd057e4d82d54e7e4ef688e419 (diff) | |
| download | enigma2-100681320b09e764b447b00a22cb3ee53d15edf7.tar.gz enigma2-100681320b09e764b447b00a22cb3ee53d15edf7.zip | |
improve audio language detection
Diffstat (limited to 'lib/python/Plugins/Extensions/DVDBurn/TitleProperties.py')
| -rw-r--r-- | lib/python/Plugins/Extensions/DVDBurn/TitleProperties.py | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/lib/python/Plugins/Extensions/DVDBurn/TitleProperties.py b/lib/python/Plugins/Extensions/DVDBurn/TitleProperties.py index fdd331d4..505dd093 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/TitleProperties.py +++ b/lib/python/Plugins/Extensions/DVDBurn/TitleProperties.py @@ -71,11 +71,11 @@ class TitleProperties(Screen,ConfigListScreen): self.list.append(getConfigListEntry("DVD " + _("Title"), self.properties.menutitle)) self.list.append(getConfigListEntry("DVD " + _("Description"), self.properties.menusubtitle)) for audiotrack in self.properties.audiotracks: - pid = audiotrack.pid.getValue() - self.list.append(getConfigListEntry("burn audio track (%s)" % pid, audiotrack.active)) + DVB_aud = audiotrack.DVB_lang.getValue() or audiotrack.pid.getValue() + self.list.append(getConfigListEntry("burn audio track (%s)" % DVB_aud, audiotrack.active)) if audiotrack.active.getValue(): - self.list.append(getConfigListEntry("audio track (%s) format" % pid, audiotrack.format)) - self.list.append(getConfigListEntry("audio track (%s) language" % pid, audiotrack.language)) + self.list.append(getConfigListEntry("audio track (%s) format" % DVB_aud, audiotrack.format)) + self.list.append(getConfigListEntry("audio track (%s) language" % DVB_aud, audiotrack.language)) self.list.append(getConfigListEntry("DVD " + _("Aspect Ratio"), self.properties.aspect)) if self.properties.aspect.getValue() == "16:9": @@ -89,7 +89,7 @@ class TitleProperties(Screen,ConfigListScreen): if len(title.chaptermarks) == 0: self.list.append(getConfigListEntry(_("Auto chapter split every ? minutes (0=never)"), self.properties.autochapter)) infotext = _("Title") + ': ' + title.DVBname + "\n" + _("Description") + ': ' + title.DVBdescr + "\n" + _("Channel") + ': ' + title.DVBchannel - chaptermarks = title.getChapterMarks() + chaptermarks = title.getChapterMarks(template="$h:$m:$s") chapters_count = len(chaptermarks) if chapters_count >= 1: infotext += ', ' + str(chapters_count+1) + ' ' + _("chapters") + ' (' @@ -127,9 +127,9 @@ class TitleProperties(Screen,ConfigListScreen): def cancel(self): self.close() +from Tools.ISO639 import LanguageCodes class LanguageChoices(): def __init__(self): - from Tools.ISO639 import LanguageCodes from Components.Language import language as syslanguage syslang = syslanguage.getLanguage()[:2] self.langdict = { } @@ -146,4 +146,26 @@ class LanguageChoices(): self.choices.insert(1,(syslang, self.langdict[syslang])) self.choices.insert(2,("en", self.langdict["en"])) + def getLanguage(self, DVB_lang): + DVB_lang = DVB_lang.lower() + isocodes = [ ] + stripwords = ["stereo", "audio", "description", "2ch"] + for word in stripwords: + 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" + languageChoices = LanguageChoices()
\ No newline at end of file |
