[gnome-music/wip/mschraal/core: 6/12] songsview: Make it play



commit 44d5fcb4d1a80c2350fee8778b9929020214dedb
Author: Marinus Schraal <mschraal gnome org>
Date:   Thu Jun 27 08:00:37 2019 +0200

    songsview: Make it play

 gnomemusic/coremodel.py       | 12 ++++++++++++
 gnomemusic/views/songsview.py |  5 +++--
 2 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/gnomemusic/coremodel.py b/gnomemusic/coremodel.py
index 5d04bfd4..872b5495 100644
--- a/gnomemusic/coremodel.py
+++ b/gnomemusic/coremodel.py
@@ -184,6 +184,18 @@ class CoreModel(GObject.GObject):
                                 song.props.state = SongWidget.State.PLAYING
 
                 self.emit("playlist-loaded")
+            elif playlist_type == PlayerPlaylist.Type.SONGS:
+                self._playlist_model.remove_all()
+
+                for song in self._model:
+                    self._playlist_model.append(song)
+
+                    if song.props.state == SongWidget.State.PLAYING:
+                        song.props.state = SongWidget.State.PLAYED
+                    if song is coresong:
+                        song.props.state = SongWidget.State.PLAYING
+
+                self.emit("playlist-loaded")
 
     @log
     def get_albums_model(self):
diff --git a/gnomemusic/views/songsview.py b/gnomemusic/views/songsview.py
index f7cf08c7..db899312 100644
--- a/gnomemusic/views/songsview.py
+++ b/gnomemusic/views/songsview.py
@@ -209,8 +209,9 @@ class SongsView(BaseView):
             return
 
         itr = self._view.props.model.get_iter(path)
-        self.player.set_playlist(
-            PlayerPlaylist.Type.SONGS, None, self.model, itr)
+        coresong = self._view.props.model[itr][5]
+        self._window._app._coremodel.set_playlist_model(
+            PlayerPlaylist.Type.SONGS, None, coresong, self._view.props.model)
         self.player.play()
 
     @log


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