[gnome-music/wip/jfelder/mpris-truly-unique-ids: 8/10] player: Define a current_song_index property for the playlist
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/mpris-truly-unique-ids: 8/10] player: Define a current_song_index property for the playlist
- Date: Wed, 29 May 2019 09:30:46 +0000 (UTC)
commit 0f5a63bd4657ae407ddd074c447ab5510c81e5c4
Author: Jean Felder <jfelder src gnome org>
Date: Tue May 28 16:34:16 2019 +0200
player: Define a current_song_index property for the playlist
Switch from a getter to a GObject property. This allows to have the
equivalent of the current_song property.
This property will be used by the player in the next commit to
uniquify the list of songs returned to MPRIS.
gnomemusic/player.py | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/gnomemusic/player.py b/gnomemusic/player.py
index 677b792c..757bca4e 100644
--- a/gnomemusic/player.py
+++ b/gnomemusic/player.py
@@ -426,11 +426,11 @@ class PlayerPlaylist(GObject.GObject):
return self.previous()
return False
- @log
- def get_current_index(self):
- """Get current song index.
+ @GObject.Property(type=int, default=0, flags=GObject.ParamFlags.READABLE)
+ def current_song_index(self):
+ """Gets current song index.
- :returns: position of the current song int the playlist.
+ :returns: position of the current song in the playlist.
:rtype: int
"""
return self._current_index
@@ -622,7 +622,7 @@ class Player(GObject.GObject):
self._gst_player.props.url = song.get_url()
- self.emit('song-changed', self._playlist.get_current_index())
+ self.emit('song-changed', self._playlist.props.current_song_index)
@log
def _on_eos(self, klass):
@@ -729,7 +729,7 @@ class Player(GObject.GObject):
:param int song_index: position of the song to remove
"""
- if self._playlist.get_current_index() == song_index:
+ if self._playlist.props.current_song_index == song_index:
if self.props.has_next:
self.next()
elif self.props.has_previous:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]