8 self.estimatedDiskspace = 0
11 self.chaptermarks = [ ]
12 self.audiotracks = [ ]
13 self.timeCreate = None
15 def addService(self, service):
17 from enigma import eServiceCenter, iServiceInformation
18 from ServiceReference import ServiceReference
19 from time import localtime, time
21 serviceHandler = eServiceCenter.getInstance()
22 info = serviceHandler.info(service)
23 self.descr = info and " " + info.getInfoString(service, iServiceInformation.sDescription) or ""
24 sTimeCreate = info.getInfo(service, iServiceInformation.sTimeCreate)
26 self.timeCreate = localtime(sTimeCreate)
27 serviceref = ServiceReference(info.getInfoString(service, iServiceInformation.sServiceref))
28 self.name = info and info.getName(service) or "Title" + t.descr
29 self.channel = serviceref.getServiceName()
30 self.inputfile = service.getPath()
31 self.filesize = path.getsize(self.inputfile)
32 self.estimatedDiskspace = self.filesize
33 self.length = info.getLength(service)
35 def produceFinalCuesheet(self):
46 self.chaptermarks = [ ]
48 # our demuxer expects *strictly* IN,OUT lists.
49 currently_in = not any(type == CUT_TYPE_IN for pts, type in self.cuesheet)
51 self.cutlist.append(0) # emulate "in" at first
53 for (pts, type) in self.cuesheet:
54 #print "pts=", pts, "type=", type, "accumulated_in=", accumulated_in, "accumulated_at=", accumulated_at, "last_in=", last_in
55 if type == CUT_TYPE_IN and not currently_in:
56 self.cutlist.append(pts)
60 if type == CUT_TYPE_OUT and currently_in:
61 self.cutlist.append(pts)
63 # accumulate the segment
64 accumulated_in += pts - last_in
68 if type == CUT_TYPE_MARK and currently_in:
69 # relocate chaptermark against "in" time. This is not 100% accurate,
70 # as the in/out points are not.
71 reloc_pts = pts - last_in + accumulated_in
72 self.chaptermarks.append(reloc_pts)
74 if len(self.cutlist) > 1:
75 part = accumulated_in / (self.length*90000.0)
76 usedsize = int ( part * self.filesize )
77 self.estimatedDiskspace = usedsize
78 self.length = accumulated_in / 90000
80 def produceAutoChapter(self, minutes):
81 if len(self.chaptermarks) < 1:
82 chapterpts = self.cutlist[0]
83 while chapterpts < self.length*90000:
84 chapterpts += 90000 * 60 * minutes
85 self.chaptermarks.append(chapterpts)