Qball's Weblog

Cover Art

Tags General 

After I’ve been pointed to a adesklet (mpd2v) for mpd and given it a try. I thougt I could do better in C. It was slow, and crashed constandly.
So my plan was to extend mpdesklet, a test-bed program (first for libmpd, later for cairo stuff):
![mpdesklet cairo 3][1]

First I thought todo it fancy and I looked at using libsoup (and use the soap interface of amazon, this was used by mpd2v too). After spending a few hours hunting for examples on how to use libsoup with soap I gave up.
So back to just using the xml interface.
Because of my bad experience with gnome-vfs lately (seems to be most bound to the use of gnome_vfs_file_info), I thought lets give libcurl a try.
After 1/2 an hour fideling I had a very decent result done:
![cover almost done][2]

After spending some extra time implementing threading for the downloading of the image/xml, and making the code a bit moduler I got the following nice looking result:
![mpdesklet cover final][3]

Now the big job moving the code into gmpc.
As I said, I made it modular, and a bit abstract.
f.e. the threading has become:
`qthread *qt = qthread_new(function_to_thread, userdir);
… code with periodic check for..

` and that’s it, so I had my initial implementation 20 minutes later: ![gmpc id3 info cover][4] After fiddeling some more, adding automatic fetching and a callback signal later I had everything working, even in the tooltip: ![gmpc cover tooltip][5] I’ve designed it so, that gmpc self cannot download cover art. You have one or more plugins that do the fetching. So if somebody has f.e. his cover-art stored together with the music, he can just add his own plugin for fetching the cover art location. And if that plugin can’t find it, gmpc can next try the amazon plugin. It isn’t finished yet, but I did made a big step in the right direction. The 2 most important things left to implement are: * If the same image is requested twice, don’t try to fetch it twice, but add the callback to the other, allready running fetch-process * Implement a order system for cover art fetching plugins. I made the qosd code from last blog in a small, still very crappy, standalone program. I might even make a release of it, and form it in a gtkwidget so everybody can use it. Depends on the amount of free time (and people asking for it). [1]: http://images.qballcow.nl/mpdesklet-cairo3.png [2]: http://images.qballcow.nl/mpdesklet-cover.png [3]: http://images.qballcow.nl/mpdesklet-cover3.png [4]: http://images.qballcow.nl/gmpc-cover-art.png [5]: http://images.qballcow.nl/gmpc-tooltip-cover.png