[gnome-music/wip/jfelder/mpris-limit-get-songs: 12/14] player: Remove validation field from get_songs method



commit 51c568f9b51a65831b8f24aa5b9072a40d728247
Author: Jean Felder <jfelder src gnome org>
Date:   Wed Oct 24 08:58:31 2018 +0200

    player: Remove validation field from get_songs method
    
    Remove the validation field from the returned list. This method is
    only used by MPRIS code which does not need the validation status.
    Add some missing docstring too.

 gnomemusic/mpris.py  |  5 ++---
 gnomemusic/player.py | 13 ++++++++-----
 2 files changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/gnomemusic/mpris.py b/gnomemusic/mpris.py
index c11206ee..7122bf66 100644
--- a/gnomemusic/mpris.py
+++ b/gnomemusic/mpris.py
@@ -24,7 +24,7 @@
 # delete this exception statement from your version.
 
 from gnomemusic.gstplayer import Playback
-from gnomemusic.player import PlayerField, PlayerPlaylist, RepeatMode
+from gnomemusic.player import PlayerPlaylist, RepeatMode
 from gnomemusic.grilo import grilo
 from gnomemusic.playlists import Playlists
 from gnomemusic.utils import View
@@ -360,8 +360,7 @@ class MediaPlayer2Service(Server):
     def _update_songs_list(self):
         self._path_list = []
         self._metadata_list = []
-        for item in self.player.get_songs():
-            song = item[PlayerField.SONG]
+        for song in self.player.get_songs():
             path = self._get_song_dbus_path(song)
             metadata = self._get_metadata(song)
             self._path_list.append(path)
diff --git a/gnomemusic/player.py b/gnomemusic/player.py
index 64f0ce5c..b5d8e8ca 100644
--- a/gnomemusic/player.py
+++ b/gnomemusic/player.py
@@ -480,13 +480,11 @@ class PlayerPlaylist(GObject.GObject):
     def get_songs(self):
         """Get the current playlist.
 
-        Each member of the list has two elements: the song, and the validation
-        status.
-
         :returns: current playlist
-        :rtype: list
+        :rtype: list of Grl.Media
         """
-        return self._songs
+        songs = [elt[PlayerField.SONG] for elt in self._songs]
+        return songs
 
 
 class Player(GObject.GObject):
@@ -837,4 +835,9 @@ class Player(GObject.GObject):
 
     @log
     def get_songs(self):
+        """Get the current playlist.
+
+        :returns: current playlist
+        :rtype: list of Grl.Media
+        """
         return self._playlist.get_songs()


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