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