* morituri/program/cdparanoia.py:
* morituri/rip/cd.py: Add a number of tries to rip a track.
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
2012-11-11 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||||
|
|
||||||
|
* morituri/program/cdparanoia.py:
|
||||||
|
* morituri/rip/cd.py:
|
||||||
|
Add a number of tries to rip a track.
|
||||||
|
|
||||||
2012-11-10 Thomas Vander Stichele <thomas at apestaart dot org>
|
2012-11-10 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||||
|
|
||||||
* misc/pep8.py (added):
|
* misc/pep8.py (added):
|
||||||
|
|||||||
@@ -53,6 +53,11 @@ class ReturnCodeError(Exception):
|
|||||||
self.args = (returncode, )
|
self.args = (returncode, )
|
||||||
self.returncode = returncode
|
self.returncode = returncode
|
||||||
|
|
||||||
|
|
||||||
|
class ChecksumException(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
_PROGRESS_RE = re.compile(r"""
|
_PROGRESS_RE = re.compile(r"""
|
||||||
^\#\#: (?P<code>.+)\s # function code
|
^\#\#: (?P<code>.+)\s # function code
|
||||||
\[(?P<function>.*)\]\s@\s # function name
|
\[(?P<function>.*)\]\s@\s # function name
|
||||||
@@ -468,27 +473,32 @@ class ReadVerifyTrackTask(log.Loggable, task.MultiSeparateTask):
|
|||||||
# FIXME: detect this before encoding
|
# FIXME: detect this before encoding
|
||||||
self.info('Checksums do not match, %08x %08x' % (
|
self.info('Checksums do not match, %08x %08x' % (
|
||||||
c1, c2))
|
c1, c2))
|
||||||
self.error('read and verify failed: test checksum')
|
self.exception = ChecksumException(
|
||||||
|
'read and verify failed: test checksum')
|
||||||
|
|
||||||
if self.tasks[5].checksum != self.checksum:
|
if self.tasks[5].checksum != self.checksum:
|
||||||
self.error('Encoding failed, checksum does not match')
|
self.exception = ChecksumException(
|
||||||
|
'Encoding failed, checksum does not match')
|
||||||
|
|
||||||
# delete the unencoded file
|
# delete the unencoded file
|
||||||
os.unlink(self._tmpwavpath)
|
os.unlink(self._tmpwavpath)
|
||||||
|
|
||||||
os.chmod(self._tmppath, self.file_mode)
|
os.chmod(self._tmppath, self.file_mode)
|
||||||
|
|
||||||
try:
|
if not self.exception:
|
||||||
self.debug('Moving to final path %r', self.path)
|
try:
|
||||||
shutil.move(self._tmppath, self.path)
|
self.debug('Moving to final path %r', self.path)
|
||||||
except IOError, e:
|
|
||||||
if e.errno == errno.ENAMETOOLONG:
|
|
||||||
self.path = common.shrinkPath(self.path)
|
|
||||||
shutil.move(self._tmppath, self.path)
|
shutil.move(self._tmppath, self.path)
|
||||||
except Exception, e:
|
except IOError, e:
|
||||||
self.debug('Exception while moving to final path %r: %r',
|
if e.errno == errno.ENAMETOOLONG:
|
||||||
self.path, log.getExceptionMessage(e))
|
self.path = common.shrinkPath(self.path)
|
||||||
self.exception = e
|
shutil.move(self._tmppath, self.path)
|
||||||
|
except Exception, e:
|
||||||
|
self.debug('Exception while moving to final path %r: %r',
|
||||||
|
self.path, log.getExceptionMessage(e))
|
||||||
|
self.exception = e
|
||||||
|
else:
|
||||||
|
os.unlink(self._tmppath)
|
||||||
else:
|
else:
|
||||||
self.debug('stop: exception %r', self.exception)
|
self.debug('stop: exception %r', self.exception)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
|
|||||||
@@ -246,7 +246,7 @@ See http://sourceforge.net/tracker/?func=detail&aid=604751&group_id=2171&atid=1
|
|||||||
except Exception, e:
|
except Exception, e:
|
||||||
self.debug('Got exception %r on try %d',
|
self.debug('Got exception %r on try %d',
|
||||||
e, tries)
|
e, tries)
|
||||||
|
|
||||||
|
|
||||||
if tries == MAX_TRIES:
|
if tries == MAX_TRIES:
|
||||||
self.error('Giving up on track %d after %d times' % (
|
self.error('Giving up on track %d after %d times' % (
|
||||||
|
|||||||
Reference in New Issue
Block a user