Created
July 7, 2017 00:50
-
-
Save thrasibule/f91e497fff415ab7cfc25ee6c965eefc to your computer and use it in GitHub Desktop.
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
import pydbus | |
from gi.repository import GLib | |
def list_player_names(): | |
bus = pydbus.SessionBus() | |
for n in bus.dbus.ListNames(): | |
if n.startswith("org.mpris.MediaPlayer2"): | |
yield bus.get(n, "/org/mpris/MediaPlayer2") | |
def callback(self, metadata): | |
print(metadata['xesam:album']) | |
print(metadata['xesam:title']) | |
if __name__ == "__main__": | |
pithos = next(list_player_names()) | |
pithos.TrackMetadataChanged.connect(callback) | |
GLib.MainLoop().run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment