I did a fair amount of hacking on JuK today, expanding the DCOP interface. I added some functions to get the album cover information of a track, get/set the random play mode, and a quick way to find the currently playing file.
Scott asked me to update the JuK wiki to keep it current. As I was updating the DCOP interface documentation, I realized that it would probably be a good idea to construct an example showing how to get the cover art information from JuK.
Not wanting to do it in C++, I decided to take a look through kdebindings, where I had been trying to install the various bindings the other day. I started going through the modules:
- Perl — NO. I like Perl, but not for GUI programming.
- Python — I wouldn’t mind it, but for some reason I haven’t been able to get the Python bindings to build ever since it was imported into CVS.
- Ruby — This wouldn’t be a bad way to go either, but I was unable to get Korundum to link (more on this later).
- JavaScript — This is what I started my attempt with. The language is simple, and it seems to be the easiest to get started with. And besides, it was the only binding that I had managed to successfully build.
Unfortunately, no matter what I did I couldn’t get my JavaScript-based example to even display anything. It’s probably a temporary bug but it’s very hard to test that way.
So now I was in a bind. There were no bindings left. However, I had been able to get pretty far with the Ruby binding… perhaps I could fix it myself. An hour of debugging later, and I realized the problem was in KMDI, which was using a private class in kdelibs that wasn’t present in the resulting .so thanks to gcc 3.4’s visibility support. I’m not sure how the apps using KMDI managed to build with that problem, but Korundum (the Ruby binding) definitely wasn’t able to. I hacked around the problem by marking the private class as exportable, and now I was able to build Korundum.
I was pretty much learning what I was doing as I went along, but I made a pretty decent sample application, which you can find on the JuK wiki. The only real bad spot about it (besides its utter simplicity) is that it has to constantly check what song JuK is playing and update accordingly, since JuK doesn’t emit any DCOP signals on a song change.
So, I hacked up my copy of JuK here to emit the DCOP signal, and it makes the logic of the script much easier, while also making it more responsive. So I’ll have to run it by wheels and see what he thinks, but I think that it would be nice for the 3rd party scripts that interface with JuK if JuK used DCOP signals more.
Finally, icefox made a pretty nifty game that uses JuK, called JuKQuiz (which can be found in kdeplayground-multimedia). Basically it uses JuK’s DCOP interface to run a quiz application where you have to guess the song that’s playing. It’s pretty inspired IMHO, a clever use of DCOP.