[SCM] morituri/master: * morituri/program/cdrdao.py: Parse version number. * morituri/rip/cd.py: Warn about cdrdao versions with a bug. * morituri/test/test_program_cdrdao.py: Test that we can parse the version.

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


The following commit has been merged in the master branch:
commit 6df7313dc40a7a6491df21efda17033d3ceabd4f
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date:   Sat Sep 5 22:06:02 2009 +0000

    	* morituri/program/cdrdao.py:
    	  Parse version number.
    	* morituri/rip/cd.py:
    	  Warn about cdrdao versions with a bug.
    	* morituri/test/test_program_cdrdao.py:
    	  Test that we can parse the version.

diff --git a/ChangeLog b/ChangeLog
index 68970b9..dc2803a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2009-09-06  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+	* morituri/program/cdrdao.py:
+	  Parse version number.
+	* morituri/rip/cd.py:
+	  Warn about cdrdao versions with a bug.
+	* morituri/test/test_program_cdrdao.py:
+	  Test that we can parse the version.
+
 2009-07-02  Thomas Vander Stichele  <thomas at apestaart dot org>
 
 	* morituri/program/cdrdao.py:
diff --git a/morituri/program/cdrdao.py b/morituri/program/cdrdao.py
index 0158cde..24575df 100644
--- a/morituri/program/cdrdao.py
+++ b/morituri/program/cdrdao.py
@@ -41,6 +41,8 @@ class ProgramError(Exception):
 
 states = ['START', 'TRACK', 'LEADOUT', 'DONE']
 
+_VERSION_RE = re.compile(r'^Cdrdao version (?P<version>.*) - \(C\)')
+
 _ANALYZING_RE = re.compile(r'^Analyzing track (?P<track>\d+).*')
 
 _TRACK_RE = re.compile(r"""
@@ -114,7 +116,9 @@ class OutputParser(object, log.Loggable):
         self._tracks = 0      # count of tracks, relative to session
         self._session = session
 
+
         self.table = table.Table() # the index table for the TOC
+        self.version = None # cdrdao version
 
     def read(self, bytes):
         self.log('received %d bytes in state %s', len(bytes), self._state)
@@ -178,6 +182,10 @@ class OutputParser(object, log.Loggable):
             getattr(self, methodName)(line)
 
     def _parse_START(self, line):
+        if line.startswith('Cdrdao version'):
+            m = _VERSION_RE.search(line)
+            self.version = m.group('version')
+
         if line.startswith('Track'):
             self.debug('Found possible track line')
             if line == "Track   Mode    Flags  Start                Length":
diff --git a/morituri/rip/cd.py b/morituri/rip/cd.py
index 9f15409..c84ab20 100644
--- a/morituri/rip/cd.py
+++ b/morituri/rip/cd.py
@@ -88,6 +88,10 @@ class Rip(logcommand.LogCommand):
         if not ptoc.object:
             t = cdrdao.ReadTOCTask(device=device)
             function(runner, t)
+            version = t.tasks[1].parser.version
+            from pkg_resources import parse_version as V
+            if V(version) <= V('1.2.3'):
+                print 'Warning: cdrdao 1.2.3 and older have a pre-gap length bug.'
             ptoc.persist(t.table)
         ittoc = ptoc.object
         assert ittoc.hasTOC()
diff --git a/morituri/test/test_program_cdrdao.py b/morituri/test/test_program_cdrdao.py
index 7c8b5eb..452d052 100644
--- a/morituri/test/test_program_cdrdao.py
+++ b/morituri/test/test_program_cdrdao.py
@@ -28,3 +28,5 @@ class ParseTestCase(unittest.TestCase):
              100219, 116291, 136188, 157504, 175275]):
             track = self._parser.table.tracks[i]
             self.assertEquals(track.getIndex(1).absolute, offset)
+
+        self.assertEquals(self._parser.version, '1.2.2')

-- 
morituri packaging



More information about the pkg-multimedia-commits mailing list