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