[gnome-music/wip/jfelder/fix-player-pause-change: 12/12] player: Fix song change while player is on pause



commit b6467bf4b28469a7a072f77ba9eec6d006fb6683
Author: Jean Felder <jfelder src gnome org>
Date:   Wed Jan 30 08:35:30 2019 +0100

    player: Fix song change while player is on pause
    
    When the player is on pause, it's impossible to change the current
    song. Indeed, play method checks the player's state but does not check
    if gstplayer's url has changed (which means that a new song has been
    loaded).
    
    Checking that the url has changed instead of the player state fixes
    the issue.
    
    Closes: #256

 gnomemusic/player.py | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
---
diff --git a/gnomemusic/player.py b/gnomemusic/player.py
index 77d066ba..6a077092 100644
--- a/gnomemusic/player.py
+++ b/gnomemusic/player.py
@@ -630,9 +630,7 @@ class Player(GObject.GObject):
         self._gst_player.props.state = Playback.LOADING
         self._time_stamp = int(time.time())
 
-        url_ = song.get_url()
-        if url_ != self._gst_player.props.url:
-            self._gst_player.props.url = url_
+        self._gst_player.props.url = song.get_url()
 
         self.emit('song-changed', self._playlist.get_current_index())
 
@@ -663,7 +661,8 @@ class Player(GObject.GObject):
                 and not self._playlist.set_song(song_offset)):
             return False
 
-        if self.props.state != Playback.PAUSED:
+        url = self._playlist.props.current_song.get_url()
+        if url != self._gst_player.props.url:
             self._load(self._playlist.props.current_song)
 
         self._gst_player.props.state = Playback.PLAYING


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