patch by: mustbenice
* morituri/program/cdparanoia.py: * morituri/result/result.py: * morituri/rip/cd.py: * morituri/test/test_program_cdparanoia.py: Get cdparanoia version. Store both cdparanoia and cdrdao versions on rip result.
This commit is contained in:
11
ChangeLog
11
ChangeLog
@@ -1,3 +1,14 @@
|
||||
2012-11-25 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||
|
||||
patch by: mustbenice
|
||||
|
||||
* morituri/program/cdparanoia.py:
|
||||
* morituri/result/result.py:
|
||||
* morituri/rip/cd.py:
|
||||
* morituri/test/test_program_cdparanoia.py:
|
||||
Get cdparanoia version.
|
||||
Store both cdparanoia and cdrdao versions on rip result.
|
||||
|
||||
2012-11-25 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||
|
||||
* morituri/program/cdparanoia.py:
|
||||
|
||||
@@ -523,3 +523,27 @@ class ReadVerifyTrackTask(log.Loggable, task.MultiSeparateTask):
|
||||
print 'WARNING: unhandled exception %r' % (e, )
|
||||
|
||||
task.MultiSeparateTask.stop(self)
|
||||
|
||||
_VERSION_RE = re.compile("^cdparanoia (?P<version>.+) release (?P<release>.+) \(.*\)")
|
||||
|
||||
|
||||
def getCdparanoiaVersion():
|
||||
version = "(Unknown)"
|
||||
|
||||
try:
|
||||
p = asyncsub.Popen(["cdparanoia", "-V"],
|
||||
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE, close_fds=True)
|
||||
version = asyncsub.recv_some(p, e=0, stderr=1)
|
||||
vre = _VERSION_RE.search(version)
|
||||
if vre and len(vre.groups()) == 2:
|
||||
version = "%s %s" % (
|
||||
vre.groupdict().get('version'),
|
||||
vre.groupdict().get('release'))
|
||||
except OSError, e:
|
||||
import errno
|
||||
if e.errno == errno.ENOENT:
|
||||
raise common.MissingDependencyException('cdparanoia')
|
||||
raise
|
||||
|
||||
return version
|
||||
|
||||
@@ -81,6 +81,13 @@ class RipResult:
|
||||
@ivar offset: sample read offset
|
||||
@ivar table: the full index table
|
||||
@type table: L{morituri.image.table.Table}
|
||||
|
||||
@ivar vendor: vendor of the CD drive
|
||||
@ivar model: model of the CD drive
|
||||
@ivar release: release of the CD drive
|
||||
|
||||
@ivar cdrdaoVersion: version of cdrdao used for the rip
|
||||
@ivar cdparanoiaVersion: version of cdparanoia used for the rip
|
||||
"""
|
||||
|
||||
offset = 0
|
||||
@@ -90,6 +97,10 @@ class RipResult:
|
||||
|
||||
vendor = None
|
||||
model = None
|
||||
release = None
|
||||
|
||||
cdrdaoVersion = None
|
||||
cdparanoiaVersion = None
|
||||
|
||||
def __init__(self):
|
||||
self.tracks = []
|
||||
|
||||
@@ -29,7 +29,7 @@ gobject.threads_init()
|
||||
from morituri.common import logcommand, common, accurip
|
||||
from morituri.common import drive, program
|
||||
from morituri.result import result
|
||||
from morituri.program import cdrdao
|
||||
from morituri.program import cdrdao, cdparanoia
|
||||
|
||||
from morituri.extern.command import command
|
||||
from morituri.extern.task import task
|
||||
@@ -139,6 +139,8 @@ Log files will log the path to tracks relative to this directory.
|
||||
prog.loadDevice(device)
|
||||
prog.unmountDevice(device)
|
||||
|
||||
version = None
|
||||
|
||||
# first, read the normal TOC, which is fast
|
||||
ptoc = common.Persister(self.options.toc_pickle or None)
|
||||
if not ptoc.object:
|
||||
@@ -200,6 +202,8 @@ See http://sourceforge.net/tracker/?func=detail&aid=604751&group_id=2171&atid=1
|
||||
|
||||
# result
|
||||
|
||||
prog.result.cdrdaoVersion = version
|
||||
prog.result.cdparanoiaVersion = cdparanoia.getCdparanoiaVersion()
|
||||
prog.result.offset = int(self.options.offset)
|
||||
prog.result.artist = prog.metadata and prog.metadata.artist \
|
||||
or 'Unknown Artist'
|
||||
@@ -208,13 +212,14 @@ See http://sourceforge.net/tracker/?func=detail&aid=604751&group_id=2171&atid=1
|
||||
# cdio is optional for now
|
||||
try:
|
||||
import cdio
|
||||
_, prog.result.vendor, prog.result.model, __ = \
|
||||
_, prog.result.vendor, prog.result.model, prog.result.release = \
|
||||
cdio.Device(device).get_hwinfo()
|
||||
except ImportError:
|
||||
self.stdout.write(
|
||||
'WARNING: pycdio not installed, cannot identify drive\n')
|
||||
prog.result.vendor = 'Unknown'
|
||||
prog.result.model = 'Unknown'
|
||||
prog.result.release = 'Unknown'
|
||||
|
||||
# FIXME: turn this into a method
|
||||
|
||||
|
||||
@@ -41,3 +41,9 @@ class ErrorTestCase(unittest.TestCase):
|
||||
|
||||
q = '%.01f %%' % (self._parser.getTrackQuality() * 100.0, )
|
||||
self.assertEquals(q, '79.6 %')
|
||||
|
||||
|
||||
class VersionTestCase(unittest.TestCase):
|
||||
|
||||
def testGetVersion(self):
|
||||
self.failUnless(cdparanoia.getCdparanoiaVersion())
|
||||
|
||||
Reference in New Issue
Block a user