[gnome-music/wip/mschraal/grilo-writeback-sync-fix: 1/2] grilo: Add idle_add to writeback functions



commit 69d25f72ff4a2f369a02ab04b8ab9f7931e4b055
Author: Marinus Schraal <mschraal gnome org>
Date:   Wed Aug 29 23:11:10 2018 +0200

    grilo: Add idle_add to writeback functions
    
    The GStreamer clock stops ticking as soon as a Grilo writeback is
    triggered. This does not pose as an immediate problem, as it is currently
    only relied upon for scrobbling and triggering Tracker writeback. However,
    it is a problem as soon as the pipeline and clock do not reset between
    songs when gapless playback is introduced.
    
    The exact core of the problem is unknown, but might be related to Grilo
    async handling: grilo#81.
    
    Calling the Grilo writeback function in an idle_add seems to resolve the
    issue until it is fixed upstream.

 gnomemusic/grilo.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/gnomemusic/grilo.py b/gnomemusic/grilo.py
index 6a90dec7..179f8cdb 100644
--- a/gnomemusic/grilo.py
+++ b/gnomemusic/grilo.py
@@ -364,7 +364,7 @@ class Grilo(GObject.GObject):
         # FIXME: We assume this is the tracker plugin.
         # FIXME: Doing this async crashes
         try:
-            self.tracker.store_metadata_sync(
+            GLib.idle_add(self.tracker.store_metadata_sync,
                 song_item, [Grl.METADATA_KEY_FAVOURITE], Grl.WriteFlags.NORMAL)
         except GLib.Error as error:
             logger.warning("Error {}: {}".format(error.domain, error.message))
@@ -456,7 +456,7 @@ class Grilo(GObject.GObject):
         # FIXME: We assume this is the tracker plugin.
         # FIXME: Doing this async crashes
         try:
-            self.tracker.store_metadata_sync(
+            GLib.idle_add(self.tracker.store_metadata_sync,
                 media, [Grl.METADATA_KEY_PLAY_COUNT], Grl.WriteFlags.NORMAL)
         except GLib.Error as error:
             logger.warning("Error {}: {}".format(error.domain, error.message))
@@ -472,7 +472,7 @@ class Grilo(GObject.GObject):
         # FIXME: We assume this is the tracker plugin.
         # FIXME: Doing this async crashes
         try:
-            self.tracker.store_metadata_sync(
+            GLib.idle_add(self.tracker.store_metadata_sync,
                 media, [Grl.METADATA_KEY_LAST_PLAYED], Grl.WriteFlags.NORMAL)
         except GLib.Error as error:
             logger.warning("Error {}: {}".format(error.domain, error.message))


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