Created
July 8, 2016 15:55
-
-
Save evanradcliffe/843543686b00577cace21bc582e84733 to your computer and use it in GitHub Desktop.
Search Genius for the current playing Spotify song.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import webbrowser | |
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") | |
# The property Metadata behaves like a python dict | |
#for key, value in metadata.items(): | |
# print key, value | |
song_name = metadata['xesam:title'] | |
print "Searching " + song_name | |
webbrowser.open('http://genius.com/search?q=' + song_name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment