[SCM] morituri/master: * morituri/program/cdparanoia.py: * morituri/rip/cd.py: Add a number of tries to rip a track.

js at users.alioth.debian.org js at users.alioth.debian.org
Sun Oct 19 20:09:42 UTC 2014


The following commit has been merged in the master branch:
commit 4a4e1ba128b5e67fddb79b07250f240cff769ada
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date:   Sun Nov 11 22:40:53 2012 +0000

    	* morituri/program/cdparanoia.py:
    	* morituri/rip/cd.py:
    	  Add a number of tries to rip a track.

diff --git a/ChangeLog b/ChangeLog
index 2ae3f98..118727b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
 	* misc/pep8.py (added):
diff --git a/morituri/program/cdparanoia.py b/morituri/program/cdparanoia.py
index 86f0dd9..d620f5a 100644
--- a/morituri/program/cdparanoia.py
+++ b/morituri/program/cdparanoia.py
@@ -53,6 +53,11 @@ class ReturnCodeError(Exception):
         self.args = (returncode, )
         self.returncode = returncode
 
+
+class ChecksumException(Exception):
+    pass
+
+
 _PROGRESS_RE = re.compile(r"""
     ^\#\#: (?P<code>.+)\s      # function code
     \[(?P<function>.*)\]\s@\s     # function name
@@ -468,27 +473,32 @@ class ReadVerifyTrackTask(log.Loggable, task.MultiSeparateTask):
                     # FIXME: detect this before encoding
                     self.info('Checksums do not match, %08x %08x' % (
                         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:
-                    self.error('Encoding failed, checksum does not match')
+                    self.exception = ChecksumException(
+                        'Encoding failed, checksum does not match')
 
                 # delete the unencoded file
                 os.unlink(self._tmpwavpath)
 
                 os.chmod(self._tmppath, self.file_mode)
 
-                try:
-                    self.debug('Moving to final path %r', self.path)
-                    shutil.move(self._tmppath, self.path)
-                except IOError, e:
-                    if e.errno == errno.ENAMETOOLONG:
-                        self.path = common.shrinkPath(self.path)
+                if not self.exception:
+                    try:
+                        self.debug('Moving to final path %r', self.path)
                         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
+                    except IOError, e:
+                        if e.errno == errno.ENAMETOOLONG:
+                            self.path = common.shrinkPath(self.path)
+                            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:
                 self.debug('stop: exception %r', self.exception)
         except Exception, e:
diff --git a/morituri/rip/cd.py b/morituri/rip/cd.py
index 01cf537..334a355 100644
--- a/morituri/rip/cd.py
+++ b/morituri/rip/cd.py
@@ -246,7 +246,7 @@ See  http://sourceforge.net/tracker/?func=detail&aid=604751&group_id=2171&atid=1
                     except Exception, e:
                         self.debug('Got exception %r on try %d',
                             e, tries)
-                        
+
 
                 if tries == MAX_TRIES:
                     self.error('Giving up on track %d after %d times' % (

-- 
morituri packaging



More information about the pkg-multimedia-commits mailing list