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



commit 0e2b3ee33be9380bd78a586e08544b2658901167
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 6e81b8a2..8418f877 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]