[gnome-music/wip/jfelder/mpris-limit-get-songs: 16/23] player: Correctly check if player playlist is set



commit ce3f5b90d3fa8e983ed6b9a3f07605adcde0a349
Author: Jean Felder <jfelder src gnome org>
Date:   Tue Oct 23 16:46:16 2018 +0200

    player: Correctly check if player playlist is set
    
    PlayerPlaylist can never be None as it is instanced at init time. The
    correct way to check if the player has a playlist is to test if
    current_song is None.

 gnomemusic/player.py | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
---
diff --git a/gnomemusic/player.py b/gnomemusic/player.py
index e4760e67..64f0ce5c 100644
--- a/gnomemusic/player.py
+++ b/gnomemusic/player.py
@@ -597,7 +597,7 @@ class Player(GObject.GObject):
     @log
     def play(self, song_index=None):
         """Play"""
-        if not self._playlist:
+        if self.props.current_song is None:
             return
 
         if (song_index is not None
@@ -779,8 +779,6 @@ class Player(GObject.GObject):
         :returns: the song being played. None if there is no playlist.
         :rtype: Grl.Media
         """
-        if not self._playlist:
-            return None
         return self._playlist.props.current_song
 
     @log


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