[gnome-music/wip/jfelder/mpris-cleanup: 23/25] mpris: Fix some PEP-8 issues
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/mpris-cleanup: 23/25] mpris: Fix some PEP-8 issues
- Date: Sat, 15 Jun 2019 14:50:03 +0000 (UTC)
commit c38ece81138a10092ab3ab575f4f5f8b8906e369
Author: Jean Felder <jfelder src gnome org>
Date: Mon Mar 18 15:09:56 2019 +0100
mpris: Fix some PEP-8 issues
Mostly some lines being too long and some wrong indentation.
gnomemusic/mpris.py | 27 +++++++++++++++------------
1 file changed, 15 insertions(+), 12 deletions(-)
---
diff --git a/gnomemusic/mpris.py b/gnomemusic/mpris.py
index 4b217ebf..b3b41f20 100644
--- a/gnomemusic/mpris.py
+++ b/gnomemusic/mpris.py
@@ -100,7 +100,7 @@ class DBusInterface:
"""
args = list(parameters.unpack())
for i, sig in enumerate(self._method_inargs[method_name]):
- if sig is 'h':
+ if sig == 'h':
msg = invocation.get_message()
fd_list = msg.get_unix_fd_list()
args[i] = fd_list.get(args[i])
@@ -524,11 +524,9 @@ class MPRIS(DBusInterface):
return
self._previous_playback_status = playback_status
- self._properties_changed(MPRIS.MEDIA_PLAYER2_PLAYER_IFACE,
- {
- 'PlaybackStatus': GLib.Variant('s', playback_status),
- },
- [])
+ self._properties_changed(
+ MPRIS.MEDIA_PLAYER2_PLAYER_IFACE,
+ {'PlaybackStatus': GLib.Variant('s', playback_status), }, [])
@log
def _on_repeat_mode_changed(self, player, param):
@@ -786,19 +784,23 @@ class MPRIS(DBusInterface):
}
elif interface_name == MPRIS.MEDIA_PLAYER2_PLAYER_IFACE:
position_msecond = int(self._player.get_position() * 1e6)
+ playback_status = self._get_playback_status()
+ is_shuffle = (self._player.props.repeat_mode == RepeatMode.SHUFFLE)
+ can_play = (self._player.props.current_song is not None)
+ has_previous = (self._player.props.has_previous)
return {
- 'PlaybackStatus': GLib.Variant('s', self._get_playback_status()),
+ 'PlaybackStatus': GLib.Variant('s', playback_status),
'LoopStatus': GLib.Variant('s', self._get_loop_status()),
'Rate': GLib.Variant('d', 1.0),
- 'Shuffle': GLib.Variant('b', self._player.props.repeat_mode == RepeatMode.SHUFFLE),
+ 'Shuffle': GLib.Variant('b', is_shuffle),
'Metadata': GLib.Variant('a{sv}', self._get_metadata()),
'Position': GLib.Variant('x', position_msecond),
'MinimumRate': GLib.Variant('d', 1.0),
'MaximumRate': GLib.Variant('d', 1.0),
'CanGoNext': GLib.Variant('b', self._player.props.has_next),
- 'CanGoPrevious': GLib.Variant('b', self._player.props.has_previous),
- 'CanPlay': GLib.Variant('b', self._player.props.current_song is not None),
- 'CanPause': GLib.Variant('b', self._player.props.current_song is not None),
+ 'CanGoPrevious': GLib.Variant('b', has_previous),
+ 'CanPlay': GLib.Variant('b', can_play),
+ 'CanPause': GLib.Variant('b', can_play),
'CanSeek': GLib.Variant('b', True),
'CanControl': GLib.Variant('b', True),
}
@@ -809,10 +811,11 @@ class MPRIS(DBusInterface):
}
elif interface_name == MPRIS.MEDIA_PLAYER2_PLAYLISTS_IFACE:
playlist_count = len(self._stored_playlists)
+ active_playlist = self._get_active_playlist()
return {
'PlaylistCount': GLib.Variant('u', playlist_count),
'Orderings': GLib.Variant('as', ['Alphabetical']),
- 'ActivePlaylist': GLib.Variant('(b(oss))', self._get_active_playlist()),
+ 'ActivePlaylist': GLib.Variant('(b(oss))', active_playlist),
}
elif interface_name == 'org.freedesktop.DBus.Properties':
return {}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]