17 lines
556 B
Python
Executable File
17 lines
556 B
Python
Executable File
#!/usr/bin/python
|
|
|
|
import dbus
|
|
import os
|
|
|
|
try:
|
|
bus = dbus.SessionBus()
|
|
spotify = bus.get_object("org.mpris.MediaPlayer2.spotify", "/org/mpris/MediaPlayer2")
|
|
spotify_iface = dbus.Interface(spotify, 'org.freedesktop.DBus.Properties')
|
|
props = spotify_iface.Get('org.mpris.MediaPlayer2.Player', 'Metadata')
|
|
song_str = str(props['xesam:artist'][0]) + " - " + str(props['xesam:title'])
|
|
print("{}\n\n{}\n".format(song_str, os.environ['COLOR7']))
|
|
# print('COLOR7' in os.environ)
|
|
exit
|
|
except dbus.exceptions.DBusException:
|
|
exit
|