[gnome-music/wip/jfelder/smoothscale-player: 3/6] player: Use second unit to set position
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/smoothscale-player: 3/6] player: Use second unit to set position
- Date: Thu, 11 Oct 2018 06:36:00 +0000 (UTC)
commit 0254b06e11d9134c796473db30ca8d4409f8c678
Author: Jean Felder <jfelder src gnome org>
Date: Wed Oct 10 08:53:25 2018 +0200
player: Use second unit to set position
Current position requested unit seems to microsecond but it's not
clear. It clearly does not work with current mpris implementation.
Change it to second to make it consistent with get_position method
wich returns a position in seconds.
Mpris seek methods still need additional work to work reliably.
gnomemusic/player.py | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/gnomemusic/player.py b/gnomemusic/player.py
index a3c1d44d..0296ca63 100644
--- a/gnomemusic/player.py
+++ b/gnomemusic/player.py
@@ -818,6 +818,13 @@ class Player(GObject.GObject):
# TODO: used by MPRIS
@log
def set_position(self, offset, start_if_ne=False, next_on_overflow=False):
+ """Change GstPlayer position.
+
+ :param int offset: requested position in second
+ :param bool start_if_ne: if position is negative, set it to zero
+ :param bool next_on_overflow: next song if position is greater than
+ duration
+ """
if offset < 0:
if start_if_ne:
offset = 0
@@ -827,8 +834,8 @@ class Player(GObject.GObject):
if self.props.duration == 0:
return
- if self.props.duration >= offset * 1000:
- self._player.seek(offset * 1000)
+ if self.props.duration >= offset:
+ self._player.seek(offset)
self.emit('seeked', offset)
elif next_on_overflow:
self.next()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]