no bluescreen when language code not exist in ISO639.py
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Mon, 6 Nov 2006 09:10:15 +0000 (09:10 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Mon, 6 Nov 2006 09:10:15 +0000 (09:10 +0000)
lib/python/Screens/InfoBarGenerics.py
lib/python/Screens/Subtitles.py

index 8cfa91c..8224d20 100644 (file)
@@ -1342,9 +1342,8 @@ class InfoBarAudioSelection:
                                language = i.getLanguage()
                                description = i.getDescription()
        
-                               if len(language) == 3:
-                                       if language in LanguageCodes:
-                                               language = LanguageCodes[language][0]
+                               if LanguageCodes.has_key(language):
+                                       language = LanguageCodes[language][0]
        
                                if len(description):
                                        description += " (" + language + ")"
index 043198c..ac2937f 100644 (file)
@@ -30,12 +30,18 @@ class Subtitles(Screen, ConfigListScreen):
                        else:
                                text = _("Enable")
                        if x[0] == 0:
-                               self.list.append(getConfigListEntry(text+" DVB "+LanguageCodes[x[4]][0], ConfigNothing(), x))
+                               if LanguageCodes.has_key(x[4]):
+                                       self.list.append(getConfigListEntry(text+" DVB "+LanguageCodes[x[4]][0], ConfigNothing(), x))
+                               else:
+                                       self.list.append(getConfigListEntry(text+" DVB "+x[4], ConfigNothing(), x))
                        elif x[0] == 1:
                                if x[4] == 'und': #undefined
                                        self.list.append(getConfigListEntry(text+" TTX "+_("Page")+" %x%02x"%(x[3],x[2]), ConfigNothing(), x))
                                else:
-                                       self.list.append(getConfigListEntry(text+" TTX "+_("Page")+" %x%02x"%(x[3],x[2])+" "+LanguageCodes[x[4]][0], ConfigNothing(), x))
+                                       if LanguageCodes.has_key(x[4]):
+                                               self.list.append(getConfigListEntry(text+" TTX "+_("Page")+" %x%02x"%(x[3],x[2])+" "+LanguageCodes[x[4]][0], ConfigNothing(), x))
+                                       else:
+                                               self.list.append(getConfigListEntry(text+" TTX "+_("Page")+" %x%02x"%(x[3],x[2])+" "+x[4], ConfigNothing(), x))
 #              return _("Disable subtitles")
                self["config"].list = self.list
                self["config"].l.setList(self.list)