[gnome-music/wip/mschraal/tracker-sort-queries] grltrackerwrapper: Order Tracker queries



commit 89c164e29a452888151018c29d326f5726d4775b
Author: Marinus Schraal <mschraal gnome org>
Date:   Wed Jul 17 11:58:37 2019 +0200

    grltrackerwrapper: Order Tracker queries
    
    The Tracker queries returned unordered results that Music orders by listmodel
    sorting. This resulted in visible sorting on load, which looks rather nervous
    on initial loading of views.
    
    Order the Tracker queries, so the results come out already ordered pretty well.
    Making the initial startup look much easier. The results are still post sorted
    by the list models as well.

 gnomemusic/grilowrappers/grltrackerwrapper.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/gnomemusic/grilowrappers/grltrackerwrapper.py b/gnomemusic/grilowrappers/grltrackerwrapper.py
index b63dd80d..3c3e4b80 100644
--- a/gnomemusic/grilowrappers/grltrackerwrapper.py
+++ b/gnomemusic/grilowrappers/grltrackerwrapper.py
@@ -386,6 +386,7 @@ class GrlTrackerWrapper(GObject.GObject):
             }
             %(location_filter)s
         }
+        ORDER BY ?title
         """.replace('\n', ' ').strip() % {
             'location_filter': self._location_filter()
         }
@@ -425,7 +426,9 @@ class GrlTrackerWrapper(GObject.GObject):
             OPTIONAL { ?song nmm:composer/nmm:artistName ?composer . }
             OPTIONAL { ?album nmm:albumArtist/nmm:artistName ?album_artist . }
             %(location_filter)s
-        } GROUP BY ?album
+        }
+        GROUP BY ?album
+        ORDER BY ?title ?album_artist ?artist ?creation_date
         """.replace('\n', ' ').strip() % {
             'location_filter': self._location_filter()
         }
@@ -460,7 +463,9 @@ class GrlTrackerWrapper(GObject.GObject):
                     nmm:musicAlbum ?album;
                     nmm:performer ?artist .
             %(location_filter)s
-        } GROUP BY ?artist
+        }
+        GROUP BY ?artist
+        ORDER BY ?artist
         """.replace('\n', ' ').strip() % {
             'location_filter': self._location_filter()
         }
@@ -541,6 +546,7 @@ class GrlTrackerWrapper(GObject.GObject):
             FILTER ( tracker:id(?album) = %(album_id)s )
             %(location_filter)s
         }
+        ORDER BY ?album_disc_number
         """.replace('\n', ' ').strip() % {
             'album_id': int(album_id),
             'location_filter': self._location_filter()
@@ -598,6 +604,7 @@ class GrlTrackerWrapper(GObject.GObject):
             )
             %(location_filter)s
         }
+        ORDER BY ?track_number
         """.replace('\n', ' ').strip() % {
             'album_id': album_id,
             'disc_nr': disc_nr,


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