[SCM] morituri/master: * morituri/image/table.py: Fix a subtle bug in our CDDB disc id calculation. The length of the audio should be calculated as the delta between leadout and start already converted (and truncated) to seconds. * morituri/test/bloc.cue: * morituri/test/test_image_toc.py: Fix up tests for this.
js at users.alioth.debian.org
js at users.alioth.debian.org
Sun Oct 19 20:08:59 UTC 2014
The following commit has been merged in the master branch:
commit dc9ac1c6e397215d56fffe71ca4823c936db46c9
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date: Fri May 15 20:33:00 2009 +0000
* morituri/image/table.py:
Fix a subtle bug in our CDDB disc id calculation.
The length of the audio should be calculated as the delta
between leadout and start already converted (and truncated)
to seconds.
* morituri/test/bloc.cue:
* morituri/test/test_image_toc.py:
Fix up tests for this.
diff --git a/ChangeLog b/ChangeLog
index cd044f2..e3db5bf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
2009-05-15 Thomas Vander Stichele <thomas at apestaart dot org>
+ * morituri/image/table.py:
+ Fix a subtle bug in our CDDB disc id calculation.
+ The length of the audio should be calculated as the delta
+ between leadout and start already converted (and truncated)
+ to seconds.
+ * morituri/test/bloc.cue:
+ * morituri/test/test_image_toc.py:
+ Fix up tests for this.
+
+2009-05-15 Thomas Vander Stichele <thomas at apestaart dot org>
+
* morituri/program/cdparanoia.py:
Fix up track counting so HTOA can be ripped again.
* examples/readhtoa.py:
diff --git a/morituri/image/table.py b/morituri/image/table.py
index 2847067..f37480e 100644
--- a/morituri/image/table.py
+++ b/morituri/image/table.py
@@ -202,18 +202,23 @@ class IndexTable(object, log.Loggable):
# last byte is the number of tracks on the CD
n = 0
+ # CD's have a standard lead-in time of 2 seconds
+ # which gets added for CDDB disc id's
+ delta = 2 * checksum.FRAMES_PER_SECOND
+ #if self.getTrackStart(1) > 0:
+ # delta = 0
+
for track in self.tracks:
- # CD's have a standard lead-in time of 2 seconds
- # which gets added for CDDB disc id's
- offset = self.getTrackStart(track.number) + \
- 2 * checksum.FRAMES_PER_SECOND
+ offset = self.getTrackStart(track.number) + delta
seconds = offset / checksum.FRAMES_PER_SECOND
n += self._cddbSum(seconds)
last = self.tracks[-1]
- leadout = self.getTrackEnd(last.number)
- frameLength = leadout - self.getTrackStart(1)
- t = frameLength / checksum.FRAMES_PER_SECOND
+ # the 'real' leadout, not offset by 150 frames
+ leadout = self.getTrackEnd(last.number) + 1
+ startSeconds = self.getTrackStart(1) / checksum.FRAMES_PER_SECOND
+ leadoutSeconds = leadout / checksum.FRAMES_PER_SECOND
+ t = leadoutSeconds - startSeconds
value = (n % 0xff) << 24 | t << 8 | len(self.tracks)
diff --git a/morituri/test/bloc.cue b/morituri/test/bloc.cue
index 09fcf0a..2176f26 100644
--- a/morituri/test/bloc.cue
+++ b/morituri/test/bloc.cue
@@ -1,4 +1,4 @@
-REM DISCID AD0BDF0D
+REM DISCID AD0BE00D
REM COMMENT "Morituri"
FILE "data.wav" WAVE
TRACK 01 AUDIO
diff --git a/morituri/test/test_image_toc.py b/morituri/test/test_image_toc.py
index 34d52d6..1bac4b0 100644
--- a/morituri/test/test_image_toc.py
+++ b/morituri/test/test_image_toc.py
@@ -125,6 +125,18 @@ class BlocTestCase(unittest.TestCase):
ref = open(os.path.join(os.path.dirname(__file__),
'bloc.cue')).read()
self.assertEquals(cue, ref)
+
+ def testCDDBId(self):
+ self.toc.table.absolutize()
+ self.assertEquals(self.toc.table.getCDDBDiscId(), 'ad0be00d')
+
+ def testAccurateRip(self):
+ # we verify it because it has failed in readdisc in the past
+ self.toc.table.absolutize()
+ self.assertEquals(self.toc.table.getAccurateRipURL(),
+ 'http://www.accuraterip.com/accuraterip/'
+ 'e/d/2/dBAR-013-001af2de-0105994e-ad0be00d.bin')
+
# The Breeders - Mountain Battles has CDText
class BreedersTestCase(unittest.TestCase):
def setUp(self):
--
morituri packaging
More information about the pkg-multimedia-commits
mailing list