[gnome-music/gbsneto/untangle-player-window-mpris: 5/6] player: Only initialize Gst once



commit b7c17bfc3346ab9091c2d7e3a27e442808626b88
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Wed Apr 10 12:13:02 2019 -0300

    player: Only initialize Gst once
    
    A small harmless point noticed while cleaning this code,
    we are initializing Gst twice. This is harmless, but it
    is good to tight things up.
    
    Make Gst be initialized by GstPlayer, and GstPbutils, by
    PlayperPlaylist. Also add docstrings to the init method.

 gnomemusic/player.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/gnomemusic/player.py b/gnomemusic/player.py
index 7335a383..762f955e 100644
--- a/gnomemusic/player.py
+++ b/gnomemusic/player.py
@@ -33,7 +33,7 @@ import gi
 gi.require_version('Gst', '1.0')
 gi.require_version('GstAudio', '1.0')
 gi.require_version('GstPbutils', '1.0')
-from gi.repository import Gio, GLib, GObject, Grl, Gst, GstPbutils
+from gi.repository import Gio, GLib, GObject, Grl, GstPbutils
 
 from gnomemusic import log
 from gnomemusic.gstplayer import GstPlayer, Playback
@@ -98,6 +98,9 @@ class PlayerPlaylist(GObject.GObject):
     def __init__(self):
         """Initialize the player playlist"""
         super().__init__()
+
+        GstPbutils.pb_utils_init()
+
         self._songs = []
         self._shuffle_indexes = []
         self._current_index = 0
@@ -580,9 +583,6 @@ class Player(GObject.GObject):
 
         self._new_clock = True
 
-        Gst.init(None)
-        GstPbutils.pb_utils_init()
-
         self._gst_player = GstPlayer(application)
         self._gst_player.connect('clock-tick', self._on_clock_tick)
         self._gst_player.connect('eos', self._on_eos)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]