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



commit 3fd9723033bace9929204f739980e513bfd83fa0
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]