[gnome-music/wip/mschraal/core: 41/86] coresong: poc sort



commit 5f0c5d6cadc7e04557de04db840e3d4d36c9930b
Author: Marinus Schraal <mschraal gnome org>
Date:   Wed May 8 22:58:44 2019 +0200

    coresong: poc sort

 gnomemusic/coremodel.py | 5 +++++
 1 file changed, 5 insertions(+)
---
diff --git a/gnomemusic/coremodel.py b/gnomemusic/coremodel.py
index c25f6f7d..2e3234fa 100644
--- a/gnomemusic/coremodel.py
+++ b/gnomemusic/coremodel.py
@@ -25,9 +25,14 @@ class CoreModel(GObject.GObject):
         store = Gio.ListStore()
         album_id = media.get_id()
 
+        def _reverse_sort(song_a, song_b):
+            return song_b.props.track_number - song_a.props.track_number
+
         def _callback(source, dunno, media, something, something2):
             if media is None:
+                store.sort(_reverse_sort)
                 return
+
             print("media", media)
 
             song = self._hash[media.get_id()]


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