From 73a7056d85f8458791b9644570babfae60ccf948 Mon Sep 17 00:00:00 2001 From: Thomas Vander Stichele Date: Sun, 18 Aug 2013 21:58:17 +0200 Subject: [PATCH] handle index 00 of track 1 specially --- morituri/image/table.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/morituri/image/table.py b/morituri/image/table.py index 9ea055c..79d1422 100644 --- a/morituri/image/table.py +++ b/morituri/image/table.py @@ -547,11 +547,19 @@ class Table(object, log.Loggable): if key in self.cdtext: lines.append('%s "%s"' % (key, self.cdtext[key])) - # add the first FILE line - path = self.tracks[0].getFirstIndex().path - counter = self.tracks[0].getFirstIndex().counter + # add the first FILE line; EAC always puts the first FILE + # statement before TRACK 01 + firstTrack = self.tracks[0] + indexOne = firstTrack.getIndex(1) + + firstIndex = firstTrack.getFirstIndex() + path = indexOne.path + counter = indexOne.counter + + assert path, "No path on TRACK 01 INDEX 01" writeFile(path) + for i, track in enumerate(self.tracks): # FIXME: skip data tracks for now if not track.audio: @@ -577,6 +585,14 @@ class Table(object, log.Loggable): for number in indexes: index = track.indexes[number] + # handle TRACK 01 INDEX 00 specially + if i == 0 and number == 0: + # if we have a silent pre-gap, output it + if not index.path: + length = indexOne.absolute - index.absolute + lines.append(" PREGAP %s" % common.framesToMSF(length)) + continue + if index.counter != counter: writeFile(index.path) counter = index.counter