fix case
[enigma2-plugins.git] / webinterface / src / WebComponents / Sources / AudioTracks.py
1 from Components.Sources.Source import Source
2 from Tools.ISO639 import LanguageCodes
3
4 class AudioTracks( Source ):
5     
6     def __init__(self, session):
7         self.session = session
8         Source.__init__(self)
9         
10     def getList(self):
11         service = self.session.nav.getCurrentService()
12         audio = service and service.audioTracks()
13         n = audio and audio.getNumberOfTracks() or 0
14         tlist = []
15         for name in dir(audio):
16             print getattr(audio, name)
17         if n > 0:
18             print "[AudioTracks.py] got %s Audiotracks!" %(n)
19             
20             for x in range(n):
21                 i = audio.getTrackInfo(x)
22                 for name in dir(i):
23                     print getattr(i, name)
24                 language = i.getLanguage()
25                 description = i.getDescription()
26                 pid = i.getPID()
27                 
28                 if LanguageCodes.has_key(language):
29                     language = LanguageCodes[language][0]
30                 
31                 if len(description):
32                     description += " (" + language + ")"
33                 else:
34                     description = language
35                 
36                 tlist.append((description, x, pid))
37         
38         return tlist
39     
40     list = property(getList)
41     lut = {"Description": 0, "Id": 1, "Pid": 2}