* morituri/image/table.py:

* morituri/test/test_image_table.py:
	  Correctly calculate MusicBrainz disc id for enhanced cd's.
This commit is contained in:
Thomas Vander Stichele
2009-05-07 15:06:37 +00:00
parent 36729a4bef
commit 54d4cecd34
3 changed files with 24 additions and 4 deletions

View File

@@ -1,3 +1,9 @@
2009-05-07 Thomas Vander Stichele <thomas at apestaart dot org>
* morituri/image/table.py:
* morituri/test/test_image_table.py:
Correctly calculate MusicBrainz disc id for enhanced cd's.
2009-05-07 Thomas Vander Stichele <thomas at apestaart dot org>
* morituri/common/task.py:

View File

@@ -147,6 +147,13 @@ class IndexTable(object, log.Loggable):
"""
return len([t for t in self.tracks if t.audio])
def hasDataTracks(self):
"""
@returns: whether this disc contains data tracks
"""
return len([t for t in self.tracks if not t.audio]) > 0
def _cddbSum(self, i):
ret = 0
while i > 0:
@@ -202,8 +209,16 @@ class IndexTable(object, log.Loggable):
# number of last track
sha1.update("%02X" % self.getAudioTracks())
leadout = self.leadout
# if the disc is multi-session, last track is the data track,
# and we should subtract 11250 + 150 from the last track's offset
# for the leadout
if self.hasDataTracks():
assert not self.tracks[-1].audio
leadout = self.tracks[-1].getIndex(1).absolute - 11250 - 150
# treat leadout offset as track 0 offset
sha1.update("%08X" % (150 + self.leadout))
sha1.update("%08X" % (150 + leadout))
# offsets of tracks
for i in range(1, 100):

View File

@@ -40,10 +40,9 @@ class LadyhawkeTestCase(unittest.TestCase):
self.assertEquals(self.table.getCDDBDiscId(), "c60af50d")
def testMusicBrainz(self):
# FIXME: doesn't seem to be the correct id, so try the example on this
# track
#print self.table.getMusicBrainzDiscId()
pass
self.assertEquals(self.table.getMusicBrainzDiscId(),
"qrJJkrLvXz5Nkvym3oZM4KI9U4A-")
def testAccurateRip(self):
self.assertEquals(self.table.getAccurateRipIds(), (