Skip to content

Instantly share code, notes, and snippets.

@bodziek666
Created November 20, 2018 22:36
Show Gist options
  • Save bodziek666/c5506ddb25a5ef5ec6e9bccd1a95be75 to your computer and use it in GitHub Desktop.
Save bodziek666/c5506ddb25a5ef5ec6e9bccd1a95be75 to your computer and use it in GitHub Desktop.
python3 - spotify dbus example
#!/usr/bin/env python3
import dbus
def main():
bus = dbus.SessionBus()
spotify = dbus.Interface(bus.get_object('org.mpris.MediaPlayer2.spotify', '/org/mpris/MediaPlayer2'), dbus_interface='org.freedesktop.DBus.Properties')
track_data = spotify.Get('org.mpris.MediaPlayer2.Player', 'Metadata')
track_url = track_data.get('xesam:url')
print(track_url)
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment