[gnome-music/wip/jfelder/mpris-fix-seek: 5/7] player: Rename _player variable to _gst_player
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/mpris-fix-seek: 5/7] player: Rename _player variable to _gst_player
- Date: Sun, 21 Oct 2018 11:24:19 +0000 (UTC)
commit 81d21d4bd391d0712612d8f6eaaeb8c66878da75
Author: Jean Felder <jfelder src gnome org>
Date: Fri Oct 19 21:04:51 2018 +0200
player: Rename _player variable to _gst_player
_player name to designate GstPlayer instance is confusing. Use
_gst_player instead.
gnomemusic/player.py | 38 +++++++++++++++++++-------------------
1 file changed, 19 insertions(+), 19 deletions(-)
---
diff --git a/gnomemusic/player.py b/gnomemusic/player.py
index d790018a..8120d081 100644
--- a/gnomemusic/player.py
+++ b/gnomemusic/player.py
@@ -529,12 +529,12 @@ class Player(GObject.GObject):
Gst.init(None)
GstPbutils.pb_utils_init()
- self._player = GstPlayer()
- self._player.connect('clock-tick', self._on_clock_tick)
- self._player.connect('eos', self._on_eos)
- self._player.bind_property(
+ self._gst_player = GstPlayer()
+ self._gst_player.connect('clock-tick', self._on_clock_tick)
+ self._gst_player.connect('eos', self._on_eos)
+ self._gst_player.bind_property(
'duration', self, 'duration', GObject.BindingFlags.SYNC_CREATE)
- self._player.bind_property(
+ self._gst_player.bind_property(
'state', self, 'state', GObject.BindingFlags.SYNC_CREATE)
root_window = parent_window.get_toplevel()
@@ -574,12 +574,12 @@ class Player(GObject.GObject):
@log
def _load(self, song):
- self._player.state = Playback.LOADING
+ self._gst_player.state = Playback.LOADING
self._time_stamp = int(time.time())
url_ = song.get_url()
- if url_ != self._player.url:
- self._player.url = url_
+ if url_ != self._gst_player.url:
+ self._gst_player.url = url_
self.emit('song-changed', self._playlist.get_current_index())
@@ -607,17 +607,17 @@ class Player(GObject.GObject):
if self.props.state != Playback.PAUSED:
self._load(self._playlist.props.current_song)
- self._player.state = Playback.PLAYING
+ self._gst_player.state = Playback.PLAYING
@log
def pause(self):
"""Pause"""
- self._player.state = Playback.PAUSED
+ self._gst_player.state = Playback.PAUSED
@log
def stop(self):
"""Stop"""
- self._player.state = Playback.STOPPED
+ self._gst_player.state = Playback.STOPPED
@log
def next(self):
@@ -634,7 +634,7 @@ class Player(GObject.GObject):
Play the previous song of the playlist, if any.
"""
- position = self._player.position
+ position = self._gst_player.position
if position >= 5:
self.set_position(0.0)
return
@@ -731,7 +731,7 @@ class Player(GObject.GObject):
@log
def _on_clock_tick(self, klass, tick):
logger.debug("Clock tick {}, player at {} seconds".format(
- tick, self._player.position))
+ tick, self._gst_player.position))
current_song = self._playlist.props.current_song
@@ -742,7 +742,7 @@ class Player(GObject.GObject):
if self.props.duration == -1.:
return
- position = self._player.position
+ position = self._gst_player.position
if position > 0:
percentage = tick / self.props.duration
if (not self._lastfm.scrobbled
@@ -809,7 +809,7 @@ class Player(GObject.GObject):
:returns: position
:rtype: float
"""
- return self._player.position
+ return self._gst_player.position
# TODO: used by MPRIS
@log
@@ -823,18 +823,18 @@ class Player(GObject.GObject):
if position_second < 0.0:
position_second = 0.0
- duration_second = self._player.props.duration
+ duration_second = self._gst_player.props.duration
if position_second <= duration_second:
- self._player.seek(position_second)
+ self._gst_player.seek(position_second)
self.emit('seek-finished', position_second)
@log
def get_volume(self):
- return self._player.volume
+ return self._gst_player.volume
@log
def set_volume(self, rate):
- self._player.volume = rate
+ self._gst_player.volume = rate
self.emit('volume-changed')
@log
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]