[gnome-music/wip/mschraal/tracker-change-tracking-fix: 6/7] grltrackerwrapper: Reuse Core{Album, Artist} on change
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/mschraal/tracker-change-tracking-fix: 6/7] grltrackerwrapper: Reuse Core{Album, Artist} on change
- Date: Sun, 20 Oct 2019 13:28:30 +0000 (UTC)
commit e991a62b7305f887e05084778a30bb7f8bb3fc8a
Author: Marinus Schraal <mschraal gnome org>
Date: Wed Oct 16 12:00:51 2019 +0200
grltrackerwrapper: Reuse Core{Album,Artist} on change
When checking for album or artist changes Music was constantly
requerying these entities in Tracker, while they only need to be queried
if not available. This made it impossible to correctly live update
albums and is inefficient as well.
Check for an existing Core{Album,Artist} before creating a new one and
use it if available.
gnomemusic/grilowrappers/grltrackerwrapper.py | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/gnomemusic/grilowrappers/grltrackerwrapper.py b/gnomemusic/grilowrappers/grltrackerwrapper.py
index fe5d5e63..ace4bb61 100644
--- a/gnomemusic/grilowrappers/grltrackerwrapper.py
+++ b/gnomemusic/grilowrappers/grltrackerwrapper.py
@@ -199,7 +199,11 @@ class GrlTrackerWrapper(GObject.GObject):
self._album_ids = album_ids
return
- album = CoreAlbum(media, self._coremodel)
+ if media.get_id() in self._album_ids.keys():
+ album = self._album_ids[media.get_id()]
+ else:
+ album = CoreAlbum(media, self._coremodel)
+
album_ids[media.get_id()] = album
options = self._fast_options.copy()
@@ -248,7 +252,11 @@ class GrlTrackerWrapper(GObject.GObject):
self._artist_ids = artist_ids
return
- artist = CoreArtist(media, self._coremodel)
+ if media.get_id() in self._artist_ids.keys():
+ artist = self._artist_ids[media.get_id()]
+ else:
+ artist = CoreArtist(media, self._coremodel)
+
artist_ids[media.get_id()] = artist
options = self._fast_options.copy()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]