[SCM] morituri/master: * morituri/test/test_common_gstreamer.py (added): * morituri/common/gstreamer.py: * morituri/test/Makefile.am: add functions to get versions of gstreamer, gst-python, and element factory plugins.
js at users.alioth.debian.org
js at users.alioth.debian.org
Sun Oct 19 20:09:48 UTC 2014
The following commit has been merged in the master branch:
commit 0a0aadfc308bc8b2f9c4433299f1bba191fedb06
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date: Sun Dec 2 21:56:19 2012 +0000
* morituri/test/test_common_gstreamer.py (added):
* morituri/common/gstreamer.py:
* morituri/test/Makefile.am:
add functions to get versions of gstreamer, gst-python,
and element factory plugins.
diff --git a/ChangeLog b/ChangeLog
index a2164cd..9c6e3ba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2012-12-02 Thomas Vander Stichele <thomas at apestaart dot org>
+ * morituri/test/test_common_gstreamer.py (added):
+ * morituri/common/gstreamer.py:
+ * morituri/test/Makefile.am:
+ add functions to get versions of gstreamer, gst-python,
+ and element factory plugins.
+
+2012-12-02 Thomas Vander Stichele <thomas at apestaart dot org>
+
* morituri/rip/debug.py:
add rip debug resultcache log command to generate a log
based on a cached result.
diff --git a/morituri/common/gstreamer.py b/morituri/common/gstreamer.py
index 2f0b1f5..16fdbb6 100644
--- a/morituri/common/gstreamer.py
+++ b/morituri/common/gstreamer.py
@@ -20,6 +20,9 @@
# You should have received a copy of the GNU General Public License
# along with morituri. If not, see <http://www.gnu.org/licenses/>.
+import re
+import commands
+
from morituri.common import log
# workaround for issue #64
@@ -48,3 +51,34 @@ def removeAudioParsers():
return
registry.remove_plugin(plugin)
+
+def gstreamerVersion():
+ import gst
+ return _versionify(gst.version())
+
+def gstPythonVersion():
+ import gst
+ return _versionify(gst.pygst_version)
+
+_VERSION_RE = re.compile(
+ "Version:\s*(?P<version>[\d.]+)")
+
+def elementFactoryVersion(name):
+ # surprisingly, there is no python way to get from an element factory
+ # to its plugin and its version directly; you can only compare
+ # with required versions
+ # Let's use gst-inspect-0.10 and wave hands and assume it points to the
+ # same version that python uses
+ output = commands.getoutput('gst-inspect-0.10 %s | grep Version' % name)
+ m = _VERSION_RE.search(output)
+ if not m:
+ return None
+ return m.group('version')
+
+
+def _versionify(tup):
+ l = list(tup)
+ if len(l) == 4 and l[3] == 0:
+ l = l[:3]
+ v = [str(n) for n in l]
+ return ".".join(v)
diff --git a/morituri/test/Makefile.am b/morituri/test/Makefile.am
index deb8b9a..396ccd1 100644
--- a/morituri/test/Makefile.am
+++ b/morituri/test/Makefile.am
@@ -10,6 +10,7 @@ EXTRA_DIST = \
test_common_config.py \
test_common_drive.py \
test_common_encode.py \
+ test_common_gstreamer.py \
test_common_musicbrainzngs.py \
test_common_program.py \
test_common_renamer.py \
diff --git a/morituri/test/test_common_gstreamer.py b/morituri/test/test_common_gstreamer.py
new file mode 100644
index 0000000..94de5c4
--- /dev/null
+++ b/morituri/test/test_common_gstreamer.py
@@ -0,0 +1,21 @@
+# -*- Mode: Python -*-
+# vi:si:et:sw=4:sts=4:ts=4
+
+from morituri.common import gstreamer
+
+from morituri.test import common
+
+
+class VersionTestCase(common.TestCase):
+
+ def testGStreamer(self):
+ version = gstreamer.gstreamerVersion()
+ self.failUnless(version.startswith('0.'))
+
+ def testGSTPython(self):
+ version = gstreamer.gstPythonVersion()
+ self.failUnless(version.startswith('0.'))
+
+ def testFlacEnc(self):
+ version = gstreamer.elementFactoryVersion('flacenc')
+ self.failUnless(version.startswith('0.'))
--
morituri packaging
More information about the pkg-multimedia-commits
mailing list