016eb71f111a85321adaf538fcf038501a3cdf3d
[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, iServiceInformation
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.getPMTInfo,
14                                 iPlayableService.evCuesheetChanged: self.refillList
15                         })
16                 self.onExecBegin.remove(self.showTutorial)
17
18         def getPMTInfo(self):
19                 service = self.session.nav.getCurrentService()
20                 audio = service and service.audioTracks()
21                 n = audio and audio.getNumberOfTracks() or 0
22                 if n > 0:
23                         for x in range(n):
24                                 i = audio.getTrackInfo(x)
25                                 language = i.getLanguage()
26                                 description = i.getDescription()
27                                 if description == "MPEG":
28                                         description = "MP2"
29                                 self.t.audiotracks.append((language, description))
30                 print "[DVDBurn getAudioTracks]", self.t.audiotracks
31                 sVideoType = service.info().getInfo(iServiceInformation.sVideoType)
32                 print "[DVDBurn getVideoType]", sVideoType
33                 if sVideoType != 0:
34                         self.close(False)
35
36         def exit(self):
37                 self.session.nav.stopService()
38                 self.close(self.cut_list[:])
39
40 class CutlistReader(TitleCutter):
41         def __init__(self, session, t):
42                 TitleCutter.__init__(self, session, t)
43
44         def getAudioTracks(self):
45                 TitleCutter.getAudioTracks()
46                 self.exit()