-
- def produceFinalCuesheet(self):
- res = [ ]
- for title in self.project.titles:
- path = title.source.getPath()
- print ">>> path:", path
- cutlist = title.cutlist
-
- # our demuxer expects *stricly* IN,OUT lists.
- first = True
- currently_in = False
- CUT_TYPE_IN = 0
- CUT_TYPE_OUT = 1
- CUT_TYPE_MARK = 2
- CUT_TYPE_LAST = 3
-
- accumulated_in = 0
- accumulated_at = 0
- last_in = 0
-
- res_cutlist = [ ]
-
- res_chaptermarks = [0]
-
- for (pts, type) in cutlist:
- if first and type == CUT_TYPE_OUT: # first mark is "out"
- res_cutlist.append(0) # emulate "in" at first
- currently_in = True
-
- first = False
-
- if type == CUT_TYPE_IN and not currently_in:
- res_cutlist.append(pts)
- last_in = pts
- currently_in = True
-
- if type == CUT_TYPE_OUT and currently_in:
- res_cutlist.append(pts)
-
- # accumulate the segment
- accumulated_in += pts - last_in
- accumulated_at = pts
- currently_in = False
-
- if type == CUT_TYPE_MARK and currently_in:
- # relocate chaptermark against "in" time. This is not 100% accurate,
- # as the in/out points are not.
- res_chaptermarks.append(pts - accumulated_at + accumulated_in)
-
- res.append( (path, res_cutlist, res_chaptermarks) )
-
- return res