<filename>modules/spotify/current_track.py
#!/usr/bin/env python

"""Current track script.

Requirements:
OS packages: dbus, libdbus-1-dev
pip packages: dbus-python
"""

import dbus

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")

print(u"\u266B " + str(metadata['xesam:title']) + ' - ' + str(metadata['xesam:artist'][0]))
<filename>modules/spotify/current_track.py
#!/usr/bin/env python

"""Current track script.

Requirements:
OS packages: dbus, libdbus-1-dev
pip packages: dbus-python
"""

import dbus

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")

print(u"\u266B " + str(metadata['xesam:title']) + ' - ' + str(metadata['xesam:artist'][0]))
#!/usr/bin/env python Current track script.  Requirements: OS packages: dbus, libdbus-1-dev pip packages: dbus-python