[SCM] morituri/master: 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.
js at users.alioth.debian.org
js at users.alioth.debian.org
Sun Oct 19 20:09:46 UTC 2014
The following commit has been merged in the master branch:
commit 31a6bd942acd8e54c04e0f4c4a2b66e17efe673b
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date: Sun Nov 25 22:00:42 2012 +0000
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.
diff --git a/ChangeLog b/ChangeLog
index e60cb48..ee1c259 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
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:
Make sure we calculate fractional speed.
diff --git a/morituri/program/cdparanoia.py b/morituri/program/cdparanoia.py
index d7e5c7c..c7d8462 100644
--- a/morituri/program/cdparanoia.py
+++ b/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
diff --git a/morituri/result/result.py b/morituri/result/result.py
index 4c4e1cd..73f1809 100644
--- a/morituri/result/result.py
+++ b/morituri/result/result.py
@@ -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 = []
diff --git a/morituri/rip/cd.py b/morituri/rip/cd.py
index 97c8b28..67a9420 100644
--- a/morituri/rip/cd.py
+++ b/morituri/rip/cd.py
@@ -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
diff --git a/morituri/test/test_program_cdparanoia.py b/morituri/test/test_program_cdparanoia.py
index fe77b94..4caedda 100644
--- a/morituri/test/test_program_cdparanoia.py
+++ b/morituri/test/test_program_cdparanoia.py
@@ -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())
--
morituri packaging
More information about the pkg-multimedia-commits
mailing list