Guayadeque: Conky integration via MPRIS daemon
I switched to Mate desktop environment recently and chose Guayadeque as my new main media player since it seems to be a very promising project and offers a whole lot of cool features.
Lately I decided to integrate the players information into my conky setup. A short search on startpage (ixquick) examined a ready-to-use conkyGuayadeque integration script. Unfortunately the performance of Guayadeque is abysmal when it comes down to DBus integration, I made some test on my own via python-dbus and Bash and it turned out that a single request can use up to 300ms until Guayadeque decides to spit out the information. Since I wanted to see the status, the repeat setting, a progress bar and some meta information like artist, title, album, rating, the conkyGuayadeque script blocked my whole Conky for about 3 to 4 seconds which is far from acceptable.
So I wrote a completely new event driven daemon reacting on Guayadeques DBus signals providing a bunch of text file objects in ~/.mpris/guayadeque which can easily be read by conky without any overhead. The performance of the daemon stays far below noticeable even if the player is running and a steady progress/percent file is written so I have my conky performance back together with all my desired information from Guayadeque.
Since the script works along the MPRIS v1 standard it should work together with other MPRIS-enabled players, too as long as they provide a MPRIS DBus interface.
Start the daemon along with your other autostart files and it will automatically wait for Guayadeque to appear on the bus. If you want to try other players e.g. rhythmbox, you can start it like that:
mpris player=rhythmbox
It will create ~/.mpris/rhythmbox and place all status information there. Without this argument „guayadeque“ is the default player (and output folder).
If you want to see the actually playing title, simply do a
cat ~/.mpris/guayadeque/title
If you want to show the gathered information in conky, here’s an example taken from my actual conky config shown in the screenshot on the right:
${voffset 5}${font Sans:size=18}${exec cat ~/.mpris/guayadeque/stateChar}${font}${voffset -5} ${font Ubuntu:size=12}Player${font}${alignr}(Repeat: ${exec cat ~/.mpris/guayadeque/repeatText})
$hr
Artist:${alignr}${exec cat ~/.mpris/guayadeque/artist}
Title:${alignr}${exec cat ~/.mpris/guayadeque/title}
Album:${alignr}${exec cat ~/.mpris/guayadeque/album}
Rating:${font Sans}${alignr}${exec cat ~/.mpris/guayadeque/stars}${font}
${execbar cat ~/.mpris/guayadeque/percent}
The whole thing is kind of quick’n’dirty by now but it’s doing its job well. Things missing:
- A sophisticated signal handler for killing the thread (e.g. doing some cleanup)
- Testing other MPRIS enabled players
- Perhaps MPRIS v2 standard support
And here we go with the script (depends on python-dbus). Download, mark as executable and add it to your autostart programs. Add the code (or similar) from above to your conky config and voilá.
The script can be used for other realtime purposes, too, take a look in ~/.mpris/[player]/ to see which informations you can get out of it.
There are some undocumented arguments for defining the output text or icons like star=*, stateText=None,Play,Pause,Stop aso.
12 comments on “Guayadeque: Conky integration via MPRIS daemon”
[…] http://mein-neues-blog.de/2013/07/05/guayadeque-conky-integration-via-mpris-daemon/ […]
Can you please share your conky script.
Hey Dippy,
very old version
slightly old version
actual version
Best markus
Thank you very much.
Hi. Thanks for sharing this script. I am trying to get it working with lollypop, which only supports mpris2 as far as I know. Do you know what it would take to get this working with the new mpris protocol?
Cheers.
Hey justin,
seems MPRIS support is broken in Lollypop, there’s no org.mpris.MediaPlayer2.Lollypop available on DBus if Lollypop is running.
Best
Markus
Thanks for getting back Markus,
Hmm, that cant be correct. I have no issues with lollypop / mpris with other mpris2 supported extensions, etc. And am able to to get mpris2 info from lollypop via terminal with something like this:
dbus-send –print-reply –type=method_call –dest=org.gnome.Lollypop /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:org.mpris.MediaPlayer2.Player string:Metadata
Im still having trouble getting your python script working because I do not know python well at all, but I am going to take a closer look and see if I can figure it out. Thanks for you time, and sharing your work, very appreciated.
Hm okay, true. I used d-feet to take a closer look at the currently active dbus clients. There only was a broken entry of lollypop but nothing in the mpris namespace. However, your call worked like a charm. Seems lollypop is quite responsive to dbus/mpris. What is the reason for using this script – there might be easier/better solutions?
After more reading, I think some of it may be down to python version. And just some general difference between mpris 2/3 thats beyond me at this point. I am just gonna take another approach entirely.
ps… reading my last comment, in hindsight it came off kinda passive-aggressive. Not my intention at all.
Cheers.
I didn’t take it offensive at all, in fact I found it very friendly („thanks for getting back“, „very appreciated“, …)
If I can help you out with some code snippets please let me know.
Okay, cool 🙂 I am going to take you up on that. So bare with me here 🙂
So all I am trying to do is output some song metadata to a simple conky bar. I think the approach I am going to use is just grep the info and output to conky. Seems to be performing fine. I have it working for Artist/title. But I also want bitrate info. Problem is, mpris2 does not have the ability to display bitrate info. I may have a dirty way around that though. Awhile back a friend of mine (that knows bash waaay better than me) helped me write a bash script that uses the media info plugin to grab the bitrate of the currently playing song. Now, there were formatting problems, as mediainfo would print out the entire path of the song as well as bitrate. Thats why the script is so complicated. I am sure I can just grep the output from the script and have conky display it….but I am getting formatting errors. Here is an example of the script I am using to grep artist info:
Now, here is the code to echo bitrate of currently playing track:
Any tips on how to grep that info like the above Artist script does? I know its a lot! No worries if not, I can prob figure it out after lots of hair pulling 🙂
Hmmmm, my code wouldnt display. My email is [not viewable to the world] if you care to see it I could email it to you. Or whatever works best.
Cheers.