def artist_info_linux():
if linux_status() == "Playing":
session_bus = dbus.SessionBus()
spotify_bus = session_bus.get_object("org.mpris.MediaPlayer2.spotify",
"/org/mpris/MediaPlayer2")
spotify_properties = dbus.Interface(spotify_bus,
"org.freedesktop.DBus.Properties")
metadata = spotify_properties.Get(
"org.mpris.MediaPlayer2.Player", "Metadata")
artist_info = metadata['xesam:artist'][0]
return artist_info
else:
return "There is nothing playing at this moment"
评论列表
文章目录