[gnome-music/wip/jfelder/restore-mpris-playlists: 9/9] mpris: Restore goto method



commit 64291a445ecc36056bc92c96f9caa6b709abcb15
Author: Jean Felder <jfelder src gnome org>
Date:   Thu Sep 26 13:41:48 2019 +0200

    mpris: Restore goto method
    
    This functionality was disabled during the core rewrite.

 gnomemusic/mpris.py | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
---
diff --git a/gnomemusic/mpris.py b/gnomemusic/mpris.py
index ce0eac47..ff8f2e07 100644
--- a/gnomemusic/mpris.py
+++ b/gnomemusic/mpris.py
@@ -30,6 +30,7 @@ from gi.repository import Gio, GLib
 
 from gnomemusic import log
 from gnomemusic.albumartcache import lookup_art_file_from_cache
+from gnomemusic.widgets.songwidget import SongWidget
 from gnomemusic.gstplayer import Playback
 from gnomemusic.player import PlayerPlaylist, RepeatMode
 
@@ -739,13 +740,15 @@ class MPRIS(DBusInterface):
 
         :param str path: Identifier of the track to skip to
         """
-        # FIXME: Dropped this for core rewrite.
-        pass
-        # current_song_path = self._get_song_dbus_path()
-        # position = self._path_list.index(current_song_path)
-        # goto_index = self._path_list.index(path)
-        # song_offset = goto_index - position
-        # self._player.play(song_offset=song_offset)
+        current_index = self._path_list.index(self._get_song_dbus_path())
+        current_coresong = self._player_model[current_index]
+
+        goto_index = self._path_list.index(path)
+        new_coresong = self._player_model[goto_index]
+
+        self._player.play(new_coresong)
+        current_coresong.props.state = SongWidget.State.PLAYED
+        new_coresong.props.state = SongWidget.State.PLAYING
 
     def _track_list_replaced(self, tracks, current_song):
         parameters = {


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