* morituri/common/accurip.py:
* morituri/image/image.py: * morituri/test/Makefile.am: * morituri/test/test_image_image.py: * morituri/test/test_common_accurip.py (added): Move accuraterip stuff to the accurip module. Move/create new test file.
This commit is contained in:
@@ -197,45 +197,3 @@ class ImageVerifyTask(task.MultiSeparateTask):
|
||||
self.lengths[trackIndex] = end - index.relative
|
||||
|
||||
task.MultiSeparateTask.stop(self)
|
||||
|
||||
# FIXME: move this method to a different module ?
|
||||
def getAccurateRipResponses(data):
|
||||
ret = []
|
||||
|
||||
while data:
|
||||
trackCount = struct.unpack("B", data[0])[0]
|
||||
bytes = 1 + 12 + trackCount * (1 + 8)
|
||||
|
||||
ret.append(AccurateRipResponse(data[:bytes]))
|
||||
data = data[bytes:]
|
||||
|
||||
return ret
|
||||
|
||||
class AccurateRipResponse(object):
|
||||
"""
|
||||
I represent the response of the AccurateRip online database.
|
||||
"""
|
||||
|
||||
trackCount = None
|
||||
discId1 = ""
|
||||
discId2 = ""
|
||||
cddbDiscId = ""
|
||||
confidences = None
|
||||
checksums = None
|
||||
|
||||
def __init__(self, data):
|
||||
self.trackCount = struct.unpack("B", data[0])[0]
|
||||
self.discId1 = "%08x" % struct.unpack("<L", data[1:5])[0]
|
||||
self.discId2 = "%08x" % struct.unpack("<L", data[5:9])[0]
|
||||
self.cddbDiscId = "%08x" % struct.unpack("<L", data[9:13])[0]
|
||||
|
||||
self.confidences = []
|
||||
self.checksums = []
|
||||
|
||||
pos = 13
|
||||
for _ in range(self.trackCount):
|
||||
confidence = struct.unpack("B", data[pos])[0]
|
||||
checksum = "%08x" % struct.unpack("<L", data[pos + 1:pos + 5])[0]
|
||||
pos += 9
|
||||
self.confidences.append(confidence)
|
||||
self.checksums.append(checksum)
|
||||
|
||||
Reference in New Issue
Block a user