[gnome-music/wip/jfelder/mpris-limit-get-songs: 12/13] player: Remove validation field from get_songs method
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/mpris-limit-get-songs: 12/13] player: Remove validation field from get_songs method
- Date: Mon, 29 Oct 2018 07:46:30 +0000 (UTC)
commit 740b38e38a710d32cf71b365e23c957254e1b791
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 to use the validation
status.
Add some missing docstring.
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 b1c1e62d..41f69005 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 8418f877..32bce1b5 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]