* 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.
This commit is contained in:
Thomas Vander Stichele
2009-05-15 19:06:29 +00:00
parent 2f384d32cd
commit e87dc1b471
4 changed files with 25 additions and 10 deletions

View File

@@ -1,3 +1,12 @@
2009-05-15 Thomas Vander Stichele <thomas at apestaart dot org>
* 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 <thomas at apestaart dot org>
* morituri/image/toc.py:

View File

@@ -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)

View File

@@ -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

View File

@@ -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')