[modules/spotify] fix layout parameter

This commit is contained in:
tobi-wan-kenobi 2020-06-30 07:20:54 +02:00
parent 227a23fdb5
commit f75f1a9f26

View file

@ -12,6 +12,8 @@ Parameters:
contributed by `yvesh <https://github.com/yvesh>`_ - many thanks! contributed by `yvesh <https://github.com/yvesh>`_ - many thanks!
added controls by `LtPeriwinkle <https://github.com/LtPeriwinkle>`_ - many thanks! added controls by `LtPeriwinkle <https://github.com/LtPeriwinkle>`_ - many thanks!
fixed icons and layout parameter by `gkeep <https://github.com/gkeep>`_ - many thanks!
""" """
import sys import sys
@ -28,9 +30,10 @@ class Module(core.module.Module):
def __init__(self, config, theme): def __init__(self, config, theme):
super().__init__(config, theme, []) super().__init__(config, theme, [])
self.__layout = self.parameter( self.__layout = util.format.aslist(
"layout", self.parameter(
util.format.aslist("spotify.song,spotify.prev,spotify.pause,spotify.next"), "layout", "spotify.song,spotify.prev,spotify.pause,spotify.next",
)
) )
self.__song = "" self.__song = ""
@ -77,9 +80,13 @@ class Module(core.module.Module):
"cmd": self.__cmd + "PlayPause", "cmd": self.__cmd + "PlayPause",
} }
playback_status = str( playback_status = str(
dbus.Interface(dbus.SessionBus().get_object( dbus.Interface(
"org.mpris.MediaPlayer2.spotify", "/org/mpris/MediaPlayer2"), "org.freedesktop.DBus.Properties") dbus.SessionBus().get_object(
.Get("org.mpris.MediaPlayer2.Player", "PlaybackStatus") "org.mpris.MediaPlayer2.spotify",
"/org/mpris/MediaPlayer2",
),
"org.freedesktop.DBus.Properties",
).Get("org.mpris.MediaPlayer2.Player", "PlaybackStatus")
) )
if playback_status == "Playing": if playback_status == "Playing":
widget.set("state", "playing") widget.set("state", "playing")