Spotify segment checks for new protocol first

This commit is contained in:
ruben 2018-03-15 08:22:44 +01:00
parent cc965526fb
commit 74c08cd538
1 changed files with 12 additions and 11 deletions

View File

@ -308,17 +308,7 @@ Requires ``dbus`` python module. Only for players that support specific protocol
class SpotifyDbusPlayerSegment(PlayerSegment):
def get_player_status(self, pl):
legacy_player_status = _get_dbus_player_status(
pl=pl,
player_name='Spotify',
bus_name='com.spotify.qt',
player_path='/',
iface_prop='org.freedesktop.DBus.Properties',
iface_player='org.freedesktop.MediaPlayer2',
)
if legacy_player_status is not None:
return legacy_player_status
return _get_dbus_player_status(
player_status = _get_dbus_player_status(
pl=pl,
player_name='Spotify',
bus_name='org.mpris.MediaPlayer2.spotify',
@ -326,6 +316,17 @@ class SpotifyDbusPlayerSegment(PlayerSegment):
iface_prop='org.freedesktop.DBus.Properties',
iface_player='org.mpris.MediaPlayer2.Player',
)
if player_status is not None:
return player_status
# Fallback for legacy spotify client with different DBus protocol
return _get_dbus_player_status(
pl=pl,
player_name='Spotify',
bus_name='com.spotify.qt',
player_path='/',
iface_prop='org.freedesktop.DBus.Properties',
iface_player='org.freedesktop.MediaPlayer2',
)
spotify_dbus = with_docstring(SpotifyDbusPlayerSegment(),