[gnome-music/wip/mschraal/player-factor-out-gstreamer] gstplayer: Pass seconds with clock-tick
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/mschraal/player-factor-out-gstreamer] gstplayer: Pass seconds with clock-tick
- Date: Sun, 18 Feb 2018 15:53:28 +0000 (UTC)
commit 912c88b53cda1686fb52c7f2a1bb9416ad85b43e
Author: Marinus Schraal <mschraal gnome org>
Date: Sun Feb 18 00:38:07 2018 +0100
gstplayer: Pass seconds with clock-tick
gnomemusic/gstplayer.py | 6 +++---
gnomemusic/player.py | 7 ++++---
2 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/gnomemusic/gstplayer.py b/gnomemusic/gstplayer.py
index 50e2858..a60ee28 100644
--- a/gnomemusic/gstplayer.py
+++ b/gnomemusic/gstplayer.py
@@ -49,7 +49,7 @@ class GstPlayer(GObject.GObject):
__gsignals__ = {
'eos': (GObject.SignalFlags.RUN_FIRST, None, ()),
- 'clock-tick': (GObject.SignalFlags.RUN_FIRST, None, ())
+ 'clock-tick': (GObject.SignalFlags.RUN_FIRST, None, (int, ))
}
def __repr__(self):
@@ -132,8 +132,8 @@ class GstPlayer(GObject.GObject):
@log
def _on_clock_tick(self, clock, time, id, data):
- print("TICK", time / 10**9)
- self.emit('clock-tick')
+ tick = time / 10**9
+ self.emit('clock-tick', tick)
@log
def _on_bus_state_changed(self, bus, message):
diff --git a/gnomemusic/player.py b/gnomemusic/player.py
index b482ffd..8de892c 100644
--- a/gnomemusic/player.py
+++ b/gnomemusic/player.py
@@ -633,18 +633,19 @@ class Player(GObject.GObject):
self._player.state = Playback.PLAYING
@log
- def _on_clock_tick(self, klass):
+ def _on_clock_tick(self, klass, tick):
seconds = int(self._player.position)
- print("TICK", seconds, self._player.position)
+ print("TICK", tick, seconds, self._player.position)
self._progress_time_label.set_label(
utils.seconds_to_string(seconds))
+ duration = self._player.duration
position = self._player.position
if position > 0:
self.played_seconds += self._seconds_period / 1000
try:
- percentage = self.played_seconds / self.duration
+ percentage = tick / duration
if (not self._lastfm.scrobbled
and percentage > 0.4):
current_media = self.get_current_media()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]