|No such thing as a small change|
How to set mpris2 music data?by morgon (Deacon)
|on Apr 23, 2014 at 22:52 UTC||Need Help??|
morgon has asked for the
wisdom of the Perl Monks concerning the following question:
I have a gnome-shell extension that displays artist and title of the current song in the top bar.
This extension gets the information via mpris2 (a d-bus interface) that is currently fed by cantana (a mpd-client) that controls a mpd-player on a remote machine.
This works nicely for local content, but not for streams because then (for whatever reason) cantata does not seem to feed the mpris2-interface.
As the strings that cantata receives from mpd need to be a bit mangled anyway I now want to replace cantanta with a Perl-script of my own.
I have figured out how to receive the information I want to display from mpd, but at the moment I cannot figure out how to feed it into the d-bus.
So my question is this: Given an artist and a title (both are strings), how can I feed this data into the mpris2 interface so that it can be properly displayed?
What I have figured out is how to do the opposite (i.e. retrieving artist/title from mpris2) like this:
This prints e.g.:
What I guess I need to do is to implement a d-bus service that implements the proper interfaces and provides a "Metadata"-property where I would then put artist and title information but at the moment I don't know how to do that.
Any help is greatly appreciated.