From 6cbfe86677b108181deb756ecf8276fe9521f691 Mon Sep 17 00:00:00 2001 From: Trygve Aaberge Date: Mon, 8 Feb 2016 00:21:33 +0100 Subject: [PATCH 1/3] gst1: Send in an argument to Gst.init As of gst-python 1.5.2, the init call requires one argument. The argument is a list of the command line options. I don't think we need to send any. This relates to #1432. --- mopidy/internal/gi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mopidy/internal/gi.py b/mopidy/internal/gi.py index 1407a657..fb9af0c9 100644 --- a/mopidy/internal/gi.py +++ b/mopidy/internal/gi.py @@ -22,7 +22,7 @@ except ImportError: """)) raise else: - Gst.is_initialized() or Gst.init() + Gst.is_initialized() or Gst.init([]) REQUIRED_GST_VERSION = (1, 2, 3) From fefb6aa5a2996329e3a9e3ef95d7e5d1bb29fb5c Mon Sep 17 00:00:00 2001 From: Trygve Aaberge Date: Mon, 8 Feb 2016 00:24:38 +0100 Subject: [PATCH 2/3] gst1: Don't check Gst.is_initialized before calling Gst.init As of gst-python 1.5.2, Gst.is_initialized throws a NotInitialized exception if run before Gst.init. Gst.init should be a noop if run again after the first call, so this should be safe. This fixes #1432. --- mopidy/internal/gi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mopidy/internal/gi.py b/mopidy/internal/gi.py index fb9af0c9..229277c3 100644 --- a/mopidy/internal/gi.py +++ b/mopidy/internal/gi.py @@ -22,7 +22,7 @@ except ImportError: """)) raise else: - Gst.is_initialized() or Gst.init([]) + Gst.init([]) REQUIRED_GST_VERSION = (1, 2, 3) From 17d96edd41a1d29f6beb2152723df50864fbad89 Mon Sep 17 00:00:00 2001 From: Trygve Aaberge Date: Mon, 8 Feb 2016 00:28:29 +0100 Subject: [PATCH 3/3] gst1: Import GstPbutils after calling Gst.init With gst-python 1.6.2, importing GstPbutils before calling Gst.init gives some warnings. --- mopidy/internal/gi.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mopidy/internal/gi.py b/mopidy/internal/gi.py index 229277c3..7fa51f09 100644 --- a/mopidy/internal/gi.py +++ b/mopidy/internal/gi.py @@ -7,8 +7,7 @@ import textwrap try: import gi gi.require_version('Gst', '1.0') - gi.require_version('GstPbutils', '1.0') - from gi.repository import GLib, GObject, Gst, GstPbutils + from gi.repository import GLib, GObject, Gst except ImportError: print(textwrap.dedent(""" ERROR: A GObject Python package was not found. @@ -23,6 +22,8 @@ except ImportError: raise else: Gst.init([]) + gi.require_version('GstPbutils', '1.0') + from gi.repository import GstPbutils REQUIRED_GST_VERSION = (1, 2, 3)