[gnome-music/wip/jfelder/mpris-cleanup: 47/67] player: Remove volume logic
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/mpris-cleanup: 47/67] player: Remove volume logic
- Date: Fri, 5 Apr 2019 20:09:54 +0000 (UTC)
commit 4a2d01a4a4ed920f418702a142b7bdffd9e2a9f2
Author: Jean Felder <jfelder src gnome org>
Date: Wed Sep 5 18:36:27 2018 +0200
player: Remove volume logic
All the volume logic is unnecessary as Music does not expose a volume
slider.
Update MPRIS code accordingly.
Related: #100
gnomemusic/gstplayer.py | 21 +--------------------
gnomemusic/mpris.py | 15 +--------------
gnomemusic/player.py | 10 ----------
3 files changed, 2 insertions(+), 44 deletions(-)
---
diff --git a/gnomemusic/gstplayer.py b/gnomemusic/gstplayer.py
index 16435c15..215db709 100644
--- a/gnomemusic/gstplayer.py
+++ b/gnomemusic/gstplayer.py
@@ -28,9 +28,8 @@ import logging
from gettext import gettext as _, ngettext
import gi
gi.require_version('Gst', '1.0')
-gi.require_version('GstAudio', '1.0')
gi.require_version('GstPbutils', '1.0')
-from gi.repository import Gtk, Gio, GObject, Gst, GstAudio, GstPbutils
+from gi.repository import Gtk, Gio, GObject, Gst, GstPbutils
from gnomemusic import log
from gnomemusic.playlists import Playlists
@@ -287,24 +286,6 @@ class GstPlayer(GObject.GObject):
"""
self._duration = duration
- @GObject.Property
- def volume(self):
- """Get current volume
-
- :return: volume
- :rtype: float
- """
- volume = self._player.get_volume(GstAudio.StreamVolumeFormat.LINEAR)
- return volume
-
- @volume.setter
- def volume(self, volume):
- """Set volume
-
- :param float volume: The volume to set (0-10)
- """
- self._player.set_volume(GstAudio.StreamVolumeFormat.LINEAR, volume)
-
@log
def seek(self, seconds):
"""Seek to position
diff --git a/gnomemusic/mpris.py b/gnomemusic/mpris.py
index 96866927..68a16775 100644
--- a/gnomemusic/mpris.py
+++ b/gnomemusic/mpris.py
@@ -166,7 +166,6 @@ class MPRIS(DBusInterface):
<property name='Shuffle' type='b' access='readwrite'/>
<property name='Metadata' type='a{sv}' access='read'>
</property>
- <property name='Volume' type='d' access='readwrite'/>
<property name='Position' type='x' access='read'/>
<property name='MinimumRate' type='d' access='read'/>
<property name='MaximumRate' type='d' access='read'/>
@@ -257,7 +256,6 @@ class MPRIS(DBusInterface):
'song-changed', self._on_current_song_changed)
self.player.connect('notify::state', self._on_player_state_changed)
self.player.connect('notify::repeat-mode', self._on_repeat_mode_changed)
- self.player.connect('volume-changed', self._on_volume_changed)
self.player.connect('prev-next-invalidated', self._on_prev_next_invalidated)
self.player.connect('seek-finished', self._on_seek_finished)
self.player.connect(
@@ -484,14 +482,6 @@ class MPRIS(DBusInterface):
},
[])
- @log
- def _on_volume_changed(self, player, data=None):
- self.PropertiesChanged(MPRIS.MEDIA_PLAYER2_PLAYER_IFACE,
- {
- 'Volume': GLib.Variant('d', self.player.get_volume()),
- },
- [])
-
@log
def _on_prev_next_invalidated(self, player, data=None):
self.PropertiesChanged(MPRIS.MEDIA_PLAYER2_PLAYER_IFACE,
@@ -709,7 +699,6 @@ class MPRIS(DBusInterface):
'Rate': GLib.Variant('d', 1.0),
'Shuffle': GLib.Variant('b', self.player.props.repeat_mode == RepeatMode.SHUFFLE),
'Metadata': GLib.Variant('a{sv}', metadata),
- 'Volume': GLib.Variant('d', self.player.get_volume()),
'Position': GLib.Variant('x', position_msecond),
'MinimumRate': GLib.Variant('d', 1.0),
'MaximumRate': GLib.Variant('d', 1.0),
@@ -744,10 +733,8 @@ class MPRIS(DBusInterface):
if property_name == 'Fullscreen':
pass
elif interface_name == MPRIS.MEDIA_PLAYER2_PLAYER_IFACE:
- if property_name == 'Rate':
+ if property_name in ['Rate', 'Volume']:
pass
- elif property_name == 'Volume':
- self.player.set_volume(new_value)
elif property_name == 'LoopStatus':
if new_value == 'None':
self.player.props.repeat_mode = RepeatMode.NONE
diff --git a/gnomemusic/player.py b/gnomemusic/player.py
index 09a18db1..d091532b 100644
--- a/gnomemusic/player.py
+++ b/gnomemusic/player.py
@@ -557,7 +557,6 @@ class Player(GObject.GObject):
'seek-finished': (GObject.SignalFlags.RUN_FIRST, None, (float,)),
'song-changed': (GObject.SignalFlags.RUN_FIRST, None, (int,)),
'song-validated': (GObject.SignalFlags.RUN_FIRST, None, (int, int)),
- 'volume-changed': (GObject.SignalFlags.RUN_FIRST, None, ()),
}
state = GObject.Property(type=int, default=Playback.STOPPED)
@@ -897,15 +896,6 @@ class Player(GObject.GObject):
self._gst_player.seek(position_second)
self.emit('seek-finished', position_second)
- @log
- def get_volume(self):
- return self._gst_player.props.volume
-
- @log
- def set_volume(self, rate):
- self._gst_player.props.volume = rate
- self.emit('volume-changed')
-
@log
def get_mpris_playlist(self):
"""Get recent and next songs from the current playlist.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]