[gnome-music/wip/mschraal/core: 180/190] player: Simplify play
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/mschraal/core: 180/190] player: Simplify play
- Date: Sun, 7 Jul 2019 21:48:33 +0000 (UTC)
commit 20fb342cc9b0d3d727f7020fc16b149ef76a77a1
Author: Marinus Schraal <mschraal gnome org>
Date: Wed Jul 3 22:35:50 2019 +0200
player: Simplify play
Drops offset, look to bring it back later.
gnomemusic/mpris.py | 3 ++-
gnomemusic/player.py | 20 ++++----------------
gnomemusic/widgets/albumwidget.py | 3 +--
gnomemusic/widgets/artistalbumswidget.py | 2 +-
4 files changed, 8 insertions(+), 20 deletions(-)
---
diff --git a/gnomemusic/mpris.py b/gnomemusic/mpris.py
index b2c5ef75..4a872c45 100644
--- a/gnomemusic/mpris.py
+++ b/gnomemusic/mpris.py
@@ -698,7 +698,8 @@ class MPRIS(DBusInterface):
position = self._path_list.index(current_song_path)
goto_index = self._path_list.index(path)
song_offset = goto_index - position
- self._player.play(song_offset=song_offset)
+ # FIXME: Dropped this for core rewrite.
+ # self._player.play(song_offset=song_offset)
def _track_list_replaced(self, tracks, current_song):
parameters = {
diff --git a/gnomemusic/player.py b/gnomemusic/player.py
index 6055e092..1d8f7c39 100644
--- a/gnomemusic/player.py
+++ b/gnomemusic/player.py
@@ -492,14 +492,13 @@ class Player(GObject.GObject):
self._gst_player.props.url = coresong.props.url
@log
- def play(self, song_changed=True, song_offset=None, coresong=None):
+ def play(self, coresong=None):
"""Play a song.
Load a new song or resume playback depending on song_changed
value. If song_offset is defined, set a new song and play it.
:param bool song_changed: indicate if a new song must be loaded
- :param int song_offset: position relative to current song
"""
if self.props.current_song is None:
return
@@ -510,17 +509,6 @@ class Player(GObject.GObject):
self._load(coresong)
self._gst_player.props.state = Playback.PLAYING
- return
-
- if (song_offset is not None
- and not self._playlist.set_song(song_offset)):
- return False
-
- if (song_changed
- or self._gapless_set):
- self._load(self._playlist.props.current_song)
-
- self._gst_player.props.state = Playback.PLAYING
@log
def pause(self):
@@ -539,7 +527,7 @@ class Player(GObject.GObject):
Play the next song of the playlist, if any.
"""
if self._playlist.next():
- self.play(None, None, self._playlist.props.current_song)
+ self.play(self._playlist.props.current_song)
@log
def previous(self):
@@ -553,7 +541,7 @@ class Player(GObject.GObject):
return
if self._playlist.previous():
- self.play(None, None, self._playlist.props.current_song)
+ self.play(self._playlist.props.current_song)
@log
def play_pause(self):
@@ -561,7 +549,7 @@ class Player(GObject.GObject):
if self.props.state == Playback.PLAYING:
self.pause()
else:
- self.play(False)
+ self.play()
@log
def set_playlist(self, playlist_type, playlist_id, model, iter_=None):
diff --git a/gnomemusic/widgets/albumwidget.py b/gnomemusic/widgets/albumwidget.py
index 8e9172a7..6e682cc0 100644
--- a/gnomemusic/widgets/albumwidget.py
+++ b/gnomemusic/widgets/albumwidget.py
@@ -155,7 +155,6 @@ class AlbumWidget(Gtk.EventBox):
@log
def _song_activated(self, widget, song_widget):
- print("activated", song_widget)
if self.props.selection_mode:
song_widget.props.selected = not song_widget.props.selected
return
@@ -164,7 +163,7 @@ class AlbumWidget(Gtk.EventBox):
coremodel = self._parent_view._window._app.props.coremodel
def _on_playlist_loaded(klass):
- self._player.play(None, None, song_widget.props.coresong)
+ self._player.play(song_widget.props.coresong)
coremodel.disconnect(signal_id)
signal_id = coremodel.connect("playlist-loaded", _on_playlist_loaded)
diff --git a/gnomemusic/widgets/artistalbumswidget.py b/gnomemusic/widgets/artistalbumswidget.py
index c87879ab..e9345d88 100644
--- a/gnomemusic/widgets/artistalbumswidget.py
+++ b/gnomemusic/widgets/artistalbumswidget.py
@@ -107,7 +107,7 @@ class ArtistAlbumsWidget(Gtk.Box):
coremodel = self._player._app.props.coremodel
def _on_playlist_loaded(klass):
- self._player.play(None, None, song_widget.props.coresong)
+ self._player.play(song_widget.props.coresong)
coremodel.disconnect(signal_id)
signal_id = coremodel.connect("playlist-loaded", _on_playlist_loaded)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]