[SCM] morituri/master: * TODO: Add a note about das capital disc. * morituri/test/release.08397059-86c1-463b-8ed0-cd596dbd174f.xml: * morituri/test/release.93a6268c-ddf1-4898-bf93-fb862b1c5c5e.xml: Add musicbrainz ws1 results for Das Capital and Ladyhawke. * morituri/test/test_common_program.py: Fix typos. Add tests for Ladyhawke and Das Capital duration and parsing. * morituri/test/test_image_table.py: Fix according to new algorithm. * morituri/test/test_image_toc.py: Get frame length for both cd's. * morituri/image/table.py: Add getFrameLength method. Fix up duration.
js at users.alioth.debian.org
js at users.alioth.debian.org
Sun Oct 19 20:09:34 UTC 2014
The following commit has been merged in the master branch:
commit 367af2523223400d7fd18c2cd8fb308490274631
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date: Sun Aug 14 14:19:50 2011 +0000
* TODO:
Add a note about das capital disc.
* morituri/test/release.08397059-86c1-463b-8ed0-cd596dbd174f.xml:
* morituri/test/release.93a6268c-ddf1-4898-bf93-fb862b1c5c5e.xml:
Add musicbrainz ws1 results for Das Capital and Ladyhawke.
* morituri/test/test_common_program.py:
Fix typos.
Add tests for Ladyhawke and Das Capital duration and parsing.
* morituri/test/test_image_table.py:
Fix according to new algorithm.
* morituri/test/test_image_toc.py:
Get frame length for both cd's.
* morituri/image/table.py:
Add getFrameLength method. Fix up duration.
diff --git a/ChangeLog b/ChangeLog
index 4fcff5a..c331b9c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,22 @@
2011-08-14 Thomas Vander Stichele <thomas at apestaart dot org>
+ * TODO:
+ Add a note about das capital disc.
+ * morituri/test/release.08397059-86c1-463b-8ed0-cd596dbd174f.xml:
+ * morituri/test/release.93a6268c-ddf1-4898-bf93-fb862b1c5c5e.xml:
+ Add musicbrainz ws1 results for Das Capital and Ladyhawke.
+ * morituri/test/test_common_program.py:
+ Fix typos.
+ Add tests for Ladyhawke and Das Capital duration and parsing.
+ * morituri/test/test_image_table.py:
+ Fix according to new algorithm.
+ * morituri/test/test_image_toc.py:
+ Get frame length for both cd's.
+ * morituri/image/table.py:
+ Add getFrameLength method. Fix up duration.
+
+2011-08-14 Thomas Vander Stichele <thomas at apestaart dot org>
+
* morituri/common/program.py:
* morituri/rip/cd.py:
Always print MusicBrainz URL.
diff --git a/TODO b/TODO
index f0c7fed..2d3ff86 100644
--- a/TODO
+++ b/TODO
@@ -35,3 +35,11 @@ TODO:
- use a temp dir, until the whole rip is good don't move it, so we easily find
half done rips
- primal scream, track 5, it rips/checks/rips/checks/encodes/checks and then complains read and verify failed. why did it encode ?
+- Musicbrainz disc id error:
+ Compare http://www.musicbrainz.org/cdtoc/MAj3xXf6QMy7G.BIFOyHyq4MySE-
+ with http://www.musicbrainz.org/cdtoc/USC1utCZbTLZy80aHvQzJw4FASk-
+ Almost same, but second is 2 seconds longer on last track, suggesting it
+ was calculated wrong (150 frame offset done wrong ?) Can't find it in
+ edit history though
+ Write an example document with this cd as an example explaining offsets
+ and id calculations
diff --git a/morituri/image/table.py b/morituri/image/table.py
index 725fa7f..1038691 100644
--- a/morituri/image/table.py
+++ b/morituri/image/table.py
@@ -297,7 +297,7 @@ class Table(object, log.Loggable):
- CDDB disc id
- number of audio tracks
- offset of index 1 of each track
- - length of disc in seconds
+ - length of disc in seconds (including data track)
@rtype: list of int
"""
@@ -323,14 +323,22 @@ class Table(object, log.Loggable):
seconds = offset / common.FRAMES_PER_SECOND
n += self._cddbSum(seconds)
- last = self.tracks[-1]
# the 'real' leadout, not offset by 150 frames
# print 'THOMAS: disc leadout', self.leadout
+ last = self.tracks[-1]
leadout = self.getTrackEnd(last.number) + 1
self.debug('leadout LBA: %d', leadout)
+
+ # FIXME: we can't replace these calculations with the getFrameLength
+ # call because the start and leadout in the algorithm get rounded
+ # before making the difference
startSeconds = self.getTrackStart(1) / common.FRAMES_PER_SECOND
leadoutSeconds = leadout / common.FRAMES_PER_SECOND
t = leadoutSeconds - startSeconds
+ # durationFrames = self.getFrameLength(data=True)
+ # duration = durationFrames / common.FRAMES_PER_SECOND
+ # assert t == duration, "%r != %r" % (t, duration)
+
debug.append(str(leadoutSeconds + 2)) # 2 is the 150 frame cddb offset
result.append(leadoutSeconds)
@@ -427,14 +435,29 @@ class Table(object, log.Loggable):
return urlparse.urlunparse((
'http', host, '/bare/cdlookup.html', '', query, ''))
+ def getFrameLength(self, data=False):
+ """
+ Get the length in frames (excluding HTOA)
+
+ @param data: whether to include the data tracks in the length
+ """
+ # the 'real' leadout, not offset by 150 frames
+ if data:
+ last = self.tracks[-1]
+ else:
+ last = self.tracks[self.getAudioTracks() - 1]
+
+ leadout = self.getTrackEnd(last.number) + 1
+ self.debug('leadout LBA: %d', leadout)
+ durationFrames = leadout - self.getTrackStart(1)
+
+ return durationFrames
+
def duration(self):
"""
- Get an estimate of the duration in ms.
+ Get the duration in ms for all audio tracks (excluding HTOA).
"""
- values = self._getMusicBrainzValues()
- leadout = values[2]
- first = values[3]
- return ((leadout - first) * 1000) / common.FRAMES_PER_SECOND
+ return int(self.getFrameLength() * 1000.0 / common.FRAMES_PER_SECOND)
def _getMusicBrainzValues(self):
"""
diff --git a/morituri/test/release.08397059-86c1-463b-8ed0-cd596dbd174f.xml b/morituri/test/release.08397059-86c1-463b-8ed0-cd596dbd174f.xml
new file mode 100644
index 0000000..156b33c
--- /dev/null
+++ b/morituri/test/release.08397059-86c1-463b-8ed0-cd596dbd174f.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- gotten from http://www.musicbrainz.org/ws/1/release/08397059-86c1-463b-8ed0-cd596dbd174f?type=xml&inc=tracks+release-events+artist -->
+<metadata xmlns="http://musicbrainz.org/ns/mmd-1.0#" >
+ <release type="Album Official" id="08397059-86c1-463b-8ed0-cd596dbd174f">
+ <title>Das Capital: The Songwriting Genius of Luke Haines and The Auteurs</title><text-representation script="Latn" language="ENG" />
+ <asin>B00009XG2O</asin>
+ <artist id="08bca401-88d5-4de7-b9c3-560a2e4c1abc">
+ <name>Luke Haines</name><sort-name>Haines, Luke</sort-name>
+ </artist>
+ <track-list>
+ <track id="38afa7d3-ddc4-4c19-a54b-1de33657417e">
+ <title>How Could I Be Wrong</title><duration>273800</duration>
+ </track>
+ <track id="811fb30e-5d6d-4a03-b2c7-989032039317">
+ <title>Showgirl</title><duration>256466</duration>
+ </track>
+ <track id="40a5b530-c65b-4ca0-9cfa-79f4f9075d38">
+ <title>Baader Meinhof</title><duration>183933</duration>
+ </track>
+ <track id="939ca81e-d633-47ad-a662-08705a4c8ff9">
+ <title>Lenny Valentino</title><duration>136133</duration>
+ </track>
+ <track id="fe713beb-362c-4fac-91a8-f212fd5e59a7">
+ <title>Starstruck</title><duration>212333</duration>
+ </track>
+ <track id="52f15292-2a52-41a7-a46d-fa84321c26a2">
+ <title>Satan Wants Me</title><duration>189666</duration>
+ </track>
+ <track id="9fd3460a-34c3-488c-82b4-9c95c6b8278d">
+ <title>Unsolved Child Murder</title><duration>146800</duration>
+ </track>
+ <track id="ab3aa8d7-309d-45b4-8533-2f779e3952c1">
+ <title>Junk Shop Clothes</title><duration>166800</duration>
+ </track>
+ <track id="12fed492-5e10-4959-af15-ddf5379e5850">
+ <title>The Mitford Sisters</title><duration>302960</duration>
+ </track>
+ <track id="8c773366-373d-432b-b287-8357d77958d5">
+ <title>Bugger Bognor</title><duration>230573</duration>
+ </track>
+ <track id="48c92b0a-3b99-4662-99b9-21649c33f3ef">
+ <title>Future Generation</title><duration>216266</duration>
+ </track>
+ </track-list>
+ <release-event-list>
+ <event country="GB" format="CD" date="2003-07-21" barcode="724359051727" catalog-number="CDHUT 81" />
+ </release-event-list>
+ </release>
+</metadata>
diff --git a/morituri/test/release.93a6268c-ddf1-4898-bf93-fb862b1c5c5e.xml b/morituri/test/release.93a6268c-ddf1-4898-bf93-fb862b1c5c5e.xml
new file mode 100644
index 0000000..dde1c28
--- /dev/null
+++ b/morituri/test/release.93a6268c-ddf1-4898-bf93-fb862b1c5c5e.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<metadata xmlns="http://musicbrainz.org/ns/mmd-1.0#" >
+ <release type="Album Official" id="93a6268c-ddf1-4898-bf93-fb862b1c5c5e">
+ <title>Ladyhawke</title><text-representation script="Latn" language="ENG" />
+ <artist id="2e547c75-36c1-49d0-984e-b14498c936f0">
+ <name>Ladyhawke</name><sort-name>Ladyhawke</sort-name>
+ </artist>
+ <track-list>
+ <track id="ad89d86b-f5c7-47f2-a97a-f2e91a05129a">
+ <title>Magic</title><duration>207000</duration>
+ </track>
+ <track id="05b6718a-eab1-424a-a403-54ff1ef2300f">
+ <title>Manipulating Woman</title><duration>215000</duration>
+ </track>
+ <track id="fc7c9e1e-c68f-41c7-a545-9bcd6b798e1e">
+ <title>My Delirium</title><duration>255000</duration>
+ </track>
+ <track id="2c64b152-63ad-4c91-af62-14a1633ae346">
+ <title>Better Than Sunday</title><duration>208000</duration>
+ </track>
+ <track id="2d85d4e3-8dc4-40e7-b8c7-b44c92d71c47">
+ <title>Another Runaway</title><duration>196000</duration>
+ </track>
+ <track id="a0f8fba5-7c49-43c8-8e52-1834aaa09604">
+ <title>Love Don't Live Here</title><duration>242000</duration>
+ </track>
+ <track id="7cf5b2b6-b39d-4357-8fba-210189f656c2">
+ <title>Back of the Van</title><duration>220000</duration>
+ </track>
+ <track id="0830bd0d-5ffe-40e4-93b3-c125eeff36a0">
+ <title>Paris Is Burning</title><duration>229000</duration>
+ </track>
+ <track id="b7b99255-f4ed-4602-96d0-0de712f37cc7">
+ <title>Professional Suicide</title><duration>223000</duration>
+ </track>
+ <track id="3b5d71ca-bd52-4204-bd82-7ae098f96e58">
+ <title>Dusk Till Dawn</title><duration>156000</duration>
+ </track>
+ <track id="1a2ab650-7084-4b2b-85bd-6d6a91593084">
+ <title>Crazy World</title><duration>215000</duration>
+ </track>
+ <track id="070a3ce4-5cdb-4a99-8b1c-675c02eaf236">
+ <title>Morning Dreams</title><duration>240000</duration>
+ </track>
+ </track-list>
+ <release-event-list>
+ <event country="AU" format="CD" date="2008-09-20" barcode="00602517801974" catalog-number="MODCD093" />
+ </release-event-list>
+ </release>
+</metadata>
diff --git a/morituri/test/test_common_program.py b/morituri/test/test_common_program.py
index 3a5d0b3..94367f2 100644
--- a/morituri/test/test_common_program.py
+++ b/morituri/test/test_common_program.py
@@ -121,6 +121,35 @@ class MetadataLengthTestCase(unittest.TestCase):
reader = wsxml.MbXmlParser()
wsMetadata = reader.parse(handle)
release = wsMetadata.getRelease()
- metadata = progam.getMetadata(release)
+ metadata = program.getMetadata(release)
self.assertEquals(metadata.duration, 2962889)
+
+ def testLadyhawke(self):
+ from musicbrainz2 import wsxml
+
+ path = os.path.join(os.path.dirname(__file__),
+ 'release.93a6268c-ddf1-4898-bf93-fb862b1c5c5e.xml')
+ handle = open(path, "rb")
+
+ reader = wsxml.MbXmlParser()
+ wsMetadata = reader.parse(handle)
+ release = wsMetadata.getRelease()
+ metadata = program.getMetadata(release)
+
+ # self.assertEquals(metadata.duration, 2609413)
+
+ def testDasCapital(self):
+ from musicbrainz2 import wsxml
+
+ path = os.path.join(os.path.dirname(__file__),
+ 'release.08397059-86c1-463b-8ed0-cd596dbd174f.xml')
+ handle = open(path, "rb")
+
+ reader = wsxml.MbXmlParser()
+ wsMetadata = reader.parse(handle)
+ release = wsMetadata.getRelease()
+ metadata = program.getMetadata(release)
+
+ # FIXME: 2 seconds longer than the duration according to table
+ self.assertEquals(metadata.duration, 2315730)
diff --git a/morituri/test/test_image_table.py b/morituri/test/test_image_table.py
index 43e59b2..c7c2111 100644
--- a/morituri/test/test_image_table.py
+++ b/morituri/test/test_image_table.py
@@ -53,7 +53,7 @@ class LadyhawkeTestCase(tcommon.TestCase):
"http://www.accuraterip.com/accuraterip/a/5/d/dBAR-012-0013bd5a-00b8d489-c60af50d.bin")
def testDuration(self):
- self.assertEquals(self.table.duration(), 2609413)
+ self.assertEquals(self.table.duration(), 2761413)
class MusicBrainzTestCase(tcommon.TestCase):
# example taken from http://musicbrainz.org/doc/DiscIDCalculation
diff --git a/morituri/test/test_image_toc.py b/morituri/test/test_image_toc.py
index 70090bf..be85cad 100644
--- a/morituri/test/test_image_toc.py
+++ b/morituri/test/test_image_toc.py
@@ -180,6 +180,15 @@ class LadyhawkeTestCase(common.TestCase):
# c60af50d 13 150 15687 31841 51016 66616 81352 99559 116070 133243
# 149997 161710 177832 207256 2807
+ def testMusicBrainz(self):
+ # URL to submit: http://mm.musicbrainz.org/bare/cdlookup.html?toc=1+11+197850+24320+44855+64090+77885+88095+104020+118245+129255+141765+164487+181780&tracks=11&id=MAj3xXf6QMy7G.BIFOyHyq4MySE-
+ self.assertEquals(self.toc.table.getMusicBrainzDiscId(),
+ "KnpGsLhvH.lPrNc1PBL21lb9Bg4-")
+
+ # FIXME: I don't trust this toc, but I can't find the CD anymore
+ def testDuration(self):
+ self.assertEquals(self.toc.table.duration(), 2761413)
+
class CapitalMergeTestCase(common.TestCase):
def setUp(self):
self.toc1 = toc.TocFile(os.path.join(os.path.dirname(__file__),
@@ -209,6 +218,13 @@ class CapitalMergeTestCase(common.TestCase):
self.assertEquals(self.table.getMusicBrainzDiscId(),
"MAj3xXf6QMy7G.BIFOyHyq4MySE-")
+ def testDuration(self):
+ # this matches track 11 end sector - track 1 start sector on musicbrainz
+ # compare to 3rd and 4th value in URL above
+ self.assertEquals(self.table.getFrameLength(), 173530)
+ self.assertEquals(self.table.duration(), 2313733)
+
+
class UnicodeTestCase(common.TestCase, common.UnicodeTestMixin):
def setUp(self):
# we copy the normal non-utf8 filename to a utf-8 filename
--
morituri packaging
More information about the pkg-multimedia-commits
mailing list