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



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

    grilo: Use idle_add for 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, triggering Tracker writeback and passing
    on the clock-tick. However, the former two are one-time events per song and
    the latter is also provided by other means.
    
    It will be 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]