* morituri/program/cdparanoia.py:

Extend FileSizeError with an extra message.
	* morituri/rip/offset.py:
	  Print a reasonable warning when we cannot rip with a certain offset.
	  See #57.
This commit is contained in:
Thomas Vander Stichele
2011-03-20 18:32:02 +00:00
parent ae2095c8c3
commit b2a74e14c6
3 changed files with 33 additions and 7 deletions

View File

@@ -1,3 +1,11 @@
2011-03-20 Thomas Vander Stichele <thomas at apestaart dot org>
* morituri/program/cdparanoia.py:
Extend FileSizeError with an extra message.
* morituri/rip/offset.py:
Print a reasonable warning when we cannot rip with a certain offset.
See #57.
2011-03-17 Thomas Vander Stichele <thomas at apestaart dot org>
* morituri/rip/drive.py:

View File

@@ -34,9 +34,10 @@ class FileSizeError(Exception):
"""
The given path does not have the expected size.
"""
def __init__(self, path):
self.args = (path, )
def __init__(self, path, message):
self.args = (path, message)
self.path = path
self.message = message
class ReturnCodeError(Exception):
"""
@@ -311,10 +312,14 @@ class ReadTrackTask(task.Task):
self.warning('file size %d did not match expected size %d',
size, expected)
if (size - expected) % common.BYTES_PER_FRAME == 0:
print 'ERROR: %d frames difference' % (
(size - expected) / common.BYTES_PER_FRAME)
self.warning('%d frames difference' % (
(size - expected) / common.BYTES_PER_FRAME))
else:
self.warning('non-integral amount of frames difference')
self.exception = FileSizeError(self.path)
self.setAndRaiseException(FileSizeError(self.path,
"File size %d did not match expected size %d" % (
size, expected)))
if not self.exception and self._popen.returncode != 0:
if self._errors:
@@ -426,6 +431,7 @@ class ReadVerifyTrackTask(task.MultiSeparateTask):
self.info('Checksums match, %08x' % c1)
self.checksum = self.testchecksum
else:
# FIXME: detect this before encoding
self.error('read and verify failed')
if self.tasks[5].checksum != self.checksum:

View File

@@ -136,7 +136,12 @@ CD in the AccurateRip database."""
for offset in self._offsets:
print 'Trying read offset %d ...' % offset
archecksum = self._arcs(runner, table, 1, offset)
try:
archecksum = self._arcs(runner, table, 1, offset)
except task.TaskException, e:
if isinstance(e.exception, cdparanoia.FileSizeError):
print 'WARNING: cannot rip with offset %d...' % offset
continue
self.debug('AR checksum calculated: %s' % archecksum)
@@ -148,7 +153,14 @@ CD in the AccurateRip database."""
# now try and rip all other tracks as well
for track in range(2, len(table.tracks) + 1):
archecksum = self._arcs(runner, table, track, offset)
try:
archecksum = self._arcs(runner, table, track, offset)
except task.TaskException, e:
if isinstance(e.exception, cdparanoia.FileSizeError):
print 'WARNING: cannot rip with offset %d...' % \
offset
continue
c, i = match(archecksum, track, responses)
if c:
self.debug('MATCHED track %d against response %d' % (