[gnome-music/wip/mschraal/grltrackerwrapper-add-removal-for-songs-model: 1/3] grltrackerwrapper: Handle missing change notification case



commit c68d5fa02bd1771b8494887c1f77d1894e7bb91a
Author: Marinus Schraal <mschraal gnome org>
Date:   Sat May 23 00:16:27 2020 +0200

    grltrackerwrapper: Handle missing change notification case
    
    When Grilo notifies that a media has changed, either a property of the
    media has changed or it has been moved within Trackers indexed
    locations.
    Music likely only uses part of the Tracker indexed locations and so
    some changes are additions/removals from Musics perspective. The code
    that handles this only dealt with additions mistakenly, add a case for
    removal too.

 gnomemusic/grilowrappers/grltrackerwrapper.py | 3 +++
 1 file changed, 3 insertions(+)
---
diff --git a/gnomemusic/grilowrappers/grltrackerwrapper.py b/gnomemusic/grilowrappers/grltrackerwrapper.py
index 4a4bcc52..f0534fac 100644
--- a/gnomemusic/grilowrappers/grltrackerwrapper.py
+++ b/gnomemusic/grilowrappers/grltrackerwrapper.py
@@ -346,6 +346,7 @@ class GrlTrackerWrapper(GObject.GObject):
                 return
 
             if not media:
+                self._remove_media(media_ids)
                 return
 
             if media.get_id() not in self._hash:
@@ -358,6 +359,8 @@ class GrlTrackerWrapper(GObject.GObject):
             else:
                 self._hash[media.get_id()].update(media)
 
+            media_ids.remove(media.get_id())
+
         options = self._fast_options.copy()
 
         self.props.source.query(


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