[gnome-music/wip/jfelder/mpris-playbackstatus-stopped: 7/7] mpris: Do not send the Stopped signal when a song ends



commit 7f67eeed63448e8e2ae78b571a1eb99921c36a1a
Author: Jean Felder <jfelder src gnome org>
Date:   Tue May 28 23:56:28 2019 +0200

    mpris: Do not send the Stopped signal when a song ends
    
    MPRIS specifications are not explicit whether the "Stopped" signal
    should be sent at the end of a song. It seems logical not to emit this
    signal if the playlist is not finished because a new song is gonna
    start. Besides, this is the behavior of all the usual audio players.
    
    This is fixed by returning the "Playing" PlaybackStatus if the player
    is in the LOADING (which happens at the end of all songs) or PLAYING
    state.
    
    Related: #282

 gnomemusic/mpris.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/gnomemusic/mpris.py b/gnomemusic/mpris.py
index 38b787b2..79fb0e40 100644
--- a/gnomemusic/mpris.py
+++ b/gnomemusic/mpris.py
@@ -242,12 +242,12 @@ class MediaPlayer2Service(Server):
     @log
     def _get_playback_status(self):
         state = self.player.props.state
-        if state == Playback.PLAYING:
-            return 'Playing'
+        if state == Playback.STOPPED:
+            return 'Stopped'
         elif state == Playback.PAUSED:
             return 'Paused'
         else:
-            return 'Stopped'
+            return 'Playing'
 
     @log
     def _get_loop_status(self):


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