* 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.
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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":
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user