* morituri/common/program.py:

AccurateRip responses should be treated per track; one response set
	  isn't necessarily from the same pressing.
	  The first response set contains all the highest confidence
	  checksums, and so on in decreasing order.
	  So don't assert about one track having a checksum matching from
	  a different response set.
	  Fixes #5.
This commit is contained in:
Thomas Vander Stichele
2011-05-22 23:26:32 +00:00
parent 573d7131b2
commit e47b30610d
2 changed files with 19 additions and 13 deletions

View File

@@ -1,3 +1,14 @@
2011-05-23 Thomas Vander Stichele <thomas at apestaart dot org>
* morituri/common/program.py:
AccurateRip responses should be treated per track; one response set
isn't necessarily from the same pressing.
The first response set contains all the highest confidence
checksums, and so on in decreasing order.
So don't assert about one track having a checksum matching from
a different response set.
Fixes #5.
2011-05-22 Thomas Vander Stichele <thomas at apestaart dot org>
based on code by: Loïc Minier <lool@dooz.org>

View File

@@ -532,31 +532,26 @@ class Program(log.Loggable):
self.warning('No AccurateRip responses, cannot verify.')
return
response = None # track which response matches, for all tracks
# now loop to match responses
for i, csum in enumerate(checksums):
trackResult = self.result.getTrackResult(i + 1)
confidence = None
response = None
# match against each response's checksum for this track
for j, r in enumerate(responses):
if "%08x" % csum == r.checksums[i]:
if not response:
response = r
else:
assert r == response, \
"checksum %08x for track %d matches wrong response %d, "\
"checksum %s" % (
csum, i + 1, j + 1, response.checksums[i])
self.debug("Track: %02d matched in AccurateRip database",
i + 1)
response = r
self.debug(
"Track %02d matched response %d of %d in "
"AccurateRip database",
i + 1, j + 1, len(responses))
trackResult.accurip = True
# FIXME: maybe checksums should be ints
trackResult.ARDBCRC = int(response.checksums[i], 16)
trackResult.ARDBCRC = int(r.checksums[i], 16)
# arsum = csum
confidence = response.confidences[i]
confidence = r.confidences[i]
trackResult.ARDBConfidence = confidence
if not trackResult.accurip: