diff --git a/ChangeLog b/ChangeLog index d945654..73ac580 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2009-05-15 Thomas Vander Stichele + + * morituri/image/table.py: + Only add DISCID if our table is a TOC (which it isn't + with our current .toc file parsing) + * morituri/test/test_image_cue.py: + * morituri/test/test_image_toc.py: + Fix up tests; testsuite passes again. + 2009-05-15 Thomas Vander Stichele * morituri/image/toc.py: diff --git a/morituri/image/table.py b/morituri/image/table.py index f2d8825..1f08055 100644 --- a/morituri/image/table.py +++ b/morituri/image/table.py @@ -334,7 +334,10 @@ class IndexTable(object, log.Loggable): if key not in main and self.cdtext.has_key(key): lines.append(" %s %s" % (key, track.cdtext[key])) - lines.append('REM DISCID %s' % self.getCDDBDiscId().upper()) + if self.hasTOC(): + lines.append('REM DISCID %s' % self.getCDDBDiscId().upper()) + else: + self.warning("Cannot write disc id, not a TOC") lines.append('REM COMMENT "%s"' % program) if self.catalog: @@ -417,7 +420,7 @@ class IndexTable(object, log.Loggable): Assumes all indexes have an absolute offset and will raise if not. """ self.debug('setFile: track %d, index %d, path %s, ' - 'length %d, counter %d', track, index, path, length, counter) + 'length %r, counter %r', track, index, path, length, counter) t = self.tracks[track - 1] i = t.indexes[index] @@ -430,8 +433,8 @@ class IndexTable(object, log.Loggable): i.path = path i.relative = i.absolute - start i.counter = counter - self.debug('Setting path %s, relative %d on ' - 'track %d, index %d, counter %d', + self.debug('Setting path %s, relative %r on ' + 'track %d, index %d, counter %r', path, i.relative, track, index, counter) try: track, index = self.getNextTrackIndex(track, index) diff --git a/morituri/test/test_image_cue.py b/morituri/test/test_image_cue.py index 3a8c06c..fbe8579 100644 --- a/morituri/test/test_image_cue.py +++ b/morituri/test/test_image_cue.py @@ -58,15 +58,16 @@ class WriteCueFileTestCase(unittest.TestCase): t = table.ITTrack(1) - t.index(1, path='track01.wav', relative=0) + t.index(1, path='track01.wav', relative=0, counter=1) it.tracks.append(t) t = table.ITTrack(2) - t.index(0, path='track01.wav', relative=1000) - t.index(1, path='track02.wav', relative=0) + t.index(0, path='track01.wav', relative=1000, counter=1) + t.index(1, path='track02.wav', relative=0, counter=2) it.tracks.append(t) - self.assertEquals(it.cue(), """FILE "track01.wav" WAVE + self.assertEquals(it.cue(), """REM COMMENT "Morituri" +FILE "track01.wav" WAVE TRACK 01 AUDIO INDEX 01 00:00:00 TRACK 02 AUDIO diff --git a/morituri/test/test_image_toc.py b/morituri/test/test_image_toc.py index a3e6007..b5047b5 100644 --- a/morituri/test/test_image_toc.py +++ b/morituri/test/test_image_toc.py @@ -68,8 +68,10 @@ class CureTestCase(unittest.TestCase): self._assertPath(1, 1, None) self._assertRelative(1, 1, None) - # adding a file to the table should fix up to including 2, 0 - self.toc.table.setFile(1, 1, 'track01.wav', 28245) + # adding the first track file with length 28324 to the table should + # relativize from absolute 0 to absolute 28323, right before track 2, + # index 1 + self.toc.table.setFile(1, 1, 'track01.wav', 28324) self._assertPath(1, 1, 'track01.wav') self._assertRelative(1, 1, 0) self._assertPath(2, 0, 'track01.wav')