[gnome-music/wip/mschraal/core: 86/92] artistview: Halfway there, albums do play



commit 0f5a348baaf7e22a16b2ed98ab16809962ba492c
Author: Marinus Schraal <mschraal gnome org>
Date:   Wed Jun 5 17:27:27 2019 +0200

    artistview: Halfway there, albums do play
    
    Needs to go one level deeper

 gnomemusic/player.py                     |  2 ++
 gnomemusic/widgets/artistalbumswidget.py |  2 +-
 gnomemusic/widgets/artistalbumwidget.py  | 24 ++++++++++++++++++------
 3 files changed, 21 insertions(+), 7 deletions(-)
---
diff --git a/gnomemusic/player.py b/gnomemusic/player.py
index 5b644373..0cf832a2 100644
--- a/gnomemusic/player.py
+++ b/gnomemusic/player.py
@@ -574,6 +574,8 @@ class Player(GObject.GObject):
         """
         super().__init__()
 
+        self._app = application
+
         self._playlist = PlayerPlaylist(application)
         self._playlist.connect('song-validated', self._on_song_validated)
 
diff --git a/gnomemusic/widgets/artistalbumswidget.py b/gnomemusic/widgets/artistalbumswidget.py
index 9cfe0873..2b5c05a8 100644
--- a/gnomemusic/widgets/artistalbumswidget.py
+++ b/gnomemusic/widgets/artistalbumswidget.py
@@ -94,7 +94,7 @@ class ArtistAlbumsWidget(Gtk.Box):
         for album in self._model:
             self._add_album(album)
 
-        self._player.connect('song-changed', self._update_model)
+        # self._player.connect('song-changed', self._update_model)
         self.show_all()
 
     @log
diff --git a/gnomemusic/widgets/artistalbumwidget.py b/gnomemusic/widgets/artistalbumwidget.py
index 11ae0793..8c31ac64 100644
--- a/gnomemusic/widgets/artistalbumwidget.py
+++ b/gnomemusic/widgets/artistalbumwidget.py
@@ -153,12 +153,24 @@ class ArtistAlbumWidget(Gtk.Box):
         if self.props.selection_mode:
             return
 
-        self._player.set_playlist(
-            PlayerPlaylist.Type.ARTIST, self._artist, song_widget.model,
-            song_widget.itr)
-        self._player.play()
-
-        return True
+        # self._player.set_playlist(
+        #     PlayerPlaylist.Type.ARTIST, self._artist, song_widget.model,
+        #     song_widget.itr)
+        # self._player.play()
+
+        # return True
+
+        self._album = None
+        def _on_playlist_loaded(klass):
+            self._player.play(None, None, song_widget._media)
+            self._player._app._coremodel.disconnect(signal_id)
+
+        # coresong = listboxrow.get_child()
+        signal_id = self._player._app._coremodel.connect(
+            "playlist-loaded", _on_playlist_loaded)
+        self._player._app._coremodel.set_playlist_model(
+            PlayerPlaylist.Type.ALBUM, self._album, song_widget._media,
+            self._model)
 
     @log
     def select_all(self):


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