[gnome-music/wip/mschraal/core: 35/57] coremodel: Get album info



commit 73adf2affaaeb45c880cd4b061d6e25e2cc72b3e
Author: Marinus Schraal <mschraal gnome org>
Date:   Wed May 8 21:37:30 2019 +0200

    coremodel: Get album info

 gnomemusic/coremodel.py            | 19 +++++++++++++++++++
 gnomemusic/widgets/albumwidget2.py |  2 +-
 2 files changed, 20 insertions(+), 1 deletion(-)
---
diff --git a/gnomemusic/coremodel.py b/gnomemusic/coremodel.py
index 75345b81..c25f6f7d 100644
--- a/gnomemusic/coremodel.py
+++ b/gnomemusic/coremodel.py
@@ -2,6 +2,7 @@ from gi.repository import GObject, Gio
 
 from gnomemusic import log
 from gnomemusic.coregrilo import CoreGrilo
+from gnomemusic.grilo import grilo
 
 
 class CoreModel(GObject.GObject):
@@ -18,3 +19,21 @@ class CoreModel(GObject.GObject):
     @log
     def get_model(self):
         return self._model
+
+    @log
+    def get_album_model(self, media):
+        store = Gio.ListStore()
+        album_id = media.get_id()
+
+        def _callback(source, dunno, media, something, something2):
+            if media is None:
+                return
+            print("media", media)
+
+            song = self._hash[media.get_id()]
+            store.append(song)
+
+        # For POC sake, use old grilo
+        grilo.populate_album_songs(media, _callback)
+
+        return store
diff --git a/gnomemusic/widgets/albumwidget2.py b/gnomemusic/widgets/albumwidget2.py
index 640ec8ee..308f4220 100644
--- a/gnomemusic/widgets/albumwidget2.py
+++ b/gnomemusic/widgets/albumwidget2.py
@@ -116,7 +116,7 @@ class AlbumWidget2(Gtk.EventBox):
 
         # grilo.populate_album_songs(album, self.add_item)
         self._listbox.bind_model(
-            self._parent_view._window._app._coremodel.get_model(),
+            self._parent_view._window._app._coremodel.get_album_model(album),
             self._create_widget)
 
     @log


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