[SCM] morituri/master: * 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.

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


The following commit has been merged in the master branch:
commit b2a74e14c60af3570edb851619b243ed0047051b
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date:   Sun Mar 20 18:32:02 2011 +0000

    	* 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.

diff --git a/ChangeLog b/ChangeLog
index f655bb4..739fc09 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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:
diff --git a/morituri/program/cdparanoia.py b/morituri/program/cdparanoia.py
index 2eb1236..f2b40a2 100644
--- a/morituri/program/cdparanoia.py
+++ b/morituri/program/cdparanoia.py
@@ -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:
diff --git a/morituri/rip/offset.py b/morituri/rip/offset.py
index c4afe9a..81266a9 100644
--- a/morituri/rip/offset.py
+++ b/morituri/rip/offset.py
@@ -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' % (

-- 
morituri packaging



More information about the pkg-multimedia-commits mailing list