75a53a0858dd03c5fae8dbfa5045e45776399cec
[enigma2.git] / lib / python / Plugins / Extensions / DVDBurn / TitleCutter.py
1 from Plugins.Extensions.CutListEditor.plugin import CutListEditor
2 from Components.ServiceEventTracker import ServiceEventTracker
3 from enigma import iPlayableService
4
5 class TitleCutter(CutListEditor):
6         def __init__(self, session, t):
7                 CutListEditor.__init__(self, session, t.source)
8                 self.skin = CutListEditor.skin
9                 self.session = session
10                 self.t = t
11                 self.__event_tracker = ServiceEventTracker(screen=self, eventmap=
12                         {
13                                 iPlayableService.evUpdatedInfo: self.getAudioTracks,
14                                 iPlayableService.evCuesheetChanged: self.refillList
15                         })
16                 self.onExecBegin.remove(self.showTutorial)
17
18         def getAudioTracks(self):
19                 service = self.session.nav.getCurrentService()
20                 audio = service and service.audioTracks()
21                 n = audio and audio.getNumberOfTracks() or 0
22                 print "self.t", self.t
23                 print "self.t.audiotracks", self.t.audiotracks
24                 if n > 0:
25                         for x in range(n):
26                                 i = audio.getTrackInfo(x)
27                                 language = i.getLanguage()
28                                 description = i.getDescription()
29                                 if description == "MPEG":
30                                         description = "MP2"
31                                 self.t.audiotracks.append((language, description))
32                 print "audiotracks", self.t.audiotracks
33
34         def exit(self):
35                 self.session.nav.stopService()
36                 self.close(self.cut_list[:])
37
38 class CutlistReader(TitleCutter):
39         def __init__(self, session, t):
40                 TitleCutter.__init__(self, session, t)
41
42         def getAudioTracks(self):
43                 TitleCutter.getAudioTracks()
44                 self.exit()