[SCM] morituri/master: * morituri/test/test_common_program.py: * morituri/common/program.py: Extract a common method to get textual representation of AccurateRip results, and test it. * morituri/rip/cd.py: * morituri/rip/image.py: Use the method.
js at users.alioth.debian.org
js at users.alioth.debian.org
Sun Oct 19 20:09:10 UTC 2014
The following commit has been merged in the master branch:
commit 1e063f08a7d364e4be71cc08e9e7ddb278e91aa6
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date: Wed Jun 24 20:47:44 2009 +0000
* morituri/test/test_common_program.py:
* morituri/common/program.py:
Extract a common method to get textual representation of
AccurateRip results, and test it.
* morituri/rip/cd.py:
* morituri/rip/image.py:
Use the method.
diff --git a/ChangeLog b/ChangeLog
index 7e60c83..321fdda 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2009-06-24 Thomas Vander Stichele <thomas at apestaart dot org>
+ * morituri/test/test_common_program.py:
+ * morituri/common/program.py:
+ Extract a common method to get textual representation of
+ AccurateRip results, and test it.
+ * morituri/rip/cd.py:
+ * morituri/rip/image.py:
+ Use the method.
+
+2009-06-24 Thomas Vander Stichele <thomas at apestaart dot org>
+
* morituri/image/table.py:
Fix deprecationwarning for python 2.6
diff --git a/morituri/common/program.py b/morituri/common/program.py
index 3e18ebe..74ee58f 100644
--- a/morituri/common/program.py
+++ b/morituri/common/program.py
@@ -458,6 +458,37 @@ class Program(log.Loggable):
else:
trackResult.ARDBCRC = int(response.checksums[i], 16)
+ def getAccurateRipResults(self):
+ """
+ @rtype: list of str
+ """
+ res = []
+
+ # loop over tracks
+ for i, trackResult in enumerate(self.result.tracks):
+
+ status = 'rip NOT accurate'
+
+ if trackResult.accurip:
+ status = 'rip accurate '
+
+ c = "(not found) "
+ ar = ", DB [notfound]"
+ if trackResult.ARDBMaxConfidence:
+ c = "(max confidence %3d)" % trackResult.ARDBMaxConfidence
+ if trackResult.ARDBConfidence is not None:
+ if trackResult.ARDBConfidence \
+ < trackResult.ARDBMaxConfidence:
+ c = "(confidence %3d of %3d)" % (
+ trackResult.ARDBConfidence,
+ trackResult.ARDBMaxConfidence)
+
+ ar = ", DB [%08x]" % trackResult.ARDBCRC
+ res.append("Track %2d: %s %s [%08x]%s" % (
+ i + 1, status, c, trackResult.ARCRC, ar))
+
+ return res
+
def writeCue(self, discName):
self.debug('write .cue file')
assert self.result.table.canCue()
diff --git a/morituri/rip/cd.py b/morituri/rip/cd.py
index 3d9e6c0..9f15409 100644
--- a/morituri/rip/cd.py
+++ b/morituri/rip/cd.py
@@ -276,32 +276,9 @@ class Rip(logcommand.LogCommand):
responses[0].cddbDiscId
- # FIXME: put accuraterip verification into a separate task/function
- # and apply here
prog.verifyImage(runner, responses)
- # loop over tracks
- for trackResult in prog.result.tracks:
-
- status = 'rip NOT accurate'
-
- if trackResult.accurip:
- status = 'rip accurate '
-
- c = "(not found)"
- ar = "(not in database)"
- if trackResult.ARDBMaxConfidence:
- c = "(max confidence %3d)" % trackResult.ARDBMaxConfidence
- if trackResult.ARDBConfidence is not None:
- if trackResult.ARDBConfidence \
- < trackResult.ARDBMaxConfidence:
- c = "(confidence %3d of %3d)" % (
- trackResult.ARDBConfidence,
- trackResult.ARDBMaxConfidence)
-
- ar = ", AR [%08x]" % trackResult.ARDBCRC
- print "Track %2d: %s %s [%08x]%s" % (
- i + 1, status, c, trackResult.ARCRC, ar)
+ print "\n".join(prog.getAccurateRipResults()) + "\n"
# write log file
logger = result.getLogger()
diff --git a/morituri/rip/image.py b/morituri/rip/image.py
index bcfc504..39ac17e 100644
--- a/morituri/rip/image.py
+++ b/morituri/rip/image.py
@@ -22,6 +22,7 @@
from morituri.common import logcommand, task, checksum, accurip, program
from morituri.image import image, cue
+from morituri.result import result
from morituri.program import cdrdao, cdparanoia
@@ -40,12 +41,18 @@ class Verify(logcommand.LogCommand):
url = cueImage.table.getAccurateRipURL()
responses = cache.retrieve(url)
- return
-
- # FIXME: finish implementation
+ # FIXME: this feels like we're poking at internals.
prog.cuePath = arg
+ prog.result = result.RipResult()
+ for track in cueImage.table.tracks:
+ tr = result.TrackResult()
+ tr.number = track.number
+ prog.result.tracks.append(tr)
+
prog.verifyImage(runner, responses)
+ print "\n".join(prog.getAccurateRipResults()) + "\n"
+
class Image(logcommand.LogCommand):
summary = "handle images"
diff --git a/morituri/test/test_common_program.py b/morituri/test/test_common_program.py
index 45f38f8..9c4dde9 100644
--- a/morituri/test/test_common_program.py
+++ b/morituri/test/test_common_program.py
@@ -51,3 +51,14 @@ class TrackImageVerifyTestCase(unittest.TestCase):
self.assertEquals(tr.ARDBMaxConfidence, 2)
# we know track 10 was ripped wrong
self.assertNotEquals(tr.ARDBCRC, checksums[10 - 1])
+
+ res = prog.getAccurateRipResults()
+ self.assertEquals(res[1 - 1],
+ "Track 1: rip NOT accurate (not found) "
+ "[620b0797], DB [notfound]")
+ self.assertEquals(res[2 - 1],
+ "Track 2: rip accurate (max confidence 2) "
+ "[af8c44c5], DB [af8c44c5]")
+ self.assertEquals(res[10 - 1],
+ "Track 10: rip NOT accurate (max confidence 2) "
+ "[16457a5a], DB [eb6e55b4]")
--
morituri packaging
More information about the pkg-multimedia-commits
mailing list