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



commit 1705f6822baa9c522c48334ca4c7bc4a0b65d3ef
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                     |  3 ++-
 gnomemusic/widgets/artistalbumswidget.py |  2 +-
 gnomemusic/widgets/artistalbumwidget.py  | 24 ++++++++++++++++++------
 3 files changed, 21 insertions(+), 8 deletions(-)
---
diff --git a/gnomemusic/player.py b/gnomemusic/player.py
index ff7b7d2a..0ab3e623 100644
--- a/gnomemusic/player.py
+++ b/gnomemusic/player.py
@@ -574,6 +574,7 @@ class Player(GObject.GObject):
         """
         super().__init__()
 
+        self._app = application
         # In the case of gapless playback, both 'about-to-finish'
         # and 'eos' can occur during the same stream. 'about-to-finish'
         # already sets self._playlist to the next song, so doing it
@@ -582,7 +583,7 @@ class Player(GObject.GObject):
         # needed.
         self._gapless_set = False
 
-        self._playlist = PlayerPlaylist(application)
+        self._playlist = PlayerPlaylist(self._app)
         self._playlist.connect('song-validated', self._on_song_validated)
 
         self._settings = application.props.settings
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]