[gnome-music/wip/mschraal/gapless-v3: 4/5] gstplayer: Don't seek until end



commit 706f90f116ec262324851649745d50cfc9b282ee
Author: Marinus Schraal <mschraal gnome org>
Date:   Mon Oct 22 08:54:57 2018 +0200

    gstplayer: Don't seek until end

 gnomemusic/gstplayer.py | 5 +++++
 gnomemusic/player.py    | 1 +
 2 files changed, 6 insertions(+)
---
diff --git a/gnomemusic/gstplayer.py b/gnomemusic/gstplayer.py
index 0366bc97..a50d0700 100644
--- a/gnomemusic/gstplayer.py
+++ b/gnomemusic/gstplayer.py
@@ -338,6 +338,11 @@ class GstPlayer(GObject.GObject):
         """
         print("seek", seconds)
         # FIXME: seek should be signalled to MPRIS
+        delta = self.props.duration - seconds
+        print("DELTA", delta)
+        if delta == 0:
+            seconds = seconds - 1
+
         self._player.seek_simple(
             Gst.Format.TIME, Gst.SeekFlags.FLUSH | Gst.SeekFlags.KEY_UNIT,
             seconds * Gst.SECOND)
diff --git a/gnomemusic/player.py b/gnomemusic/player.py
index 8686b3fc..937c59b9 100644
--- a/gnomemusic/player.py
+++ b/gnomemusic/player.py
@@ -888,6 +888,7 @@ class Player(GObject.GObject):
             position_second = 0.0
 
         duration_second = self._gst_player.props.duration
+        print("SEEK:", position_second, duration_second)
         if position_second <= duration_second:
             self._gst_player.seek(position_second)
             self.emit('seek-finished', position_second)


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