Myself, Coding, Ranting, and Madness

The Consciousness Stream Continues…

Now Playing Plugin

30 Oct 2010 11:30 Tags: None

Ah...finally, something to post which isn't abstract and boring. I've actually done some work which can1 be muttered about here. And due to that the fact a lurgy has me pretty much bed bound, and my laptop will barely run Civ 5, and I suddenly have time to update my blog. This has been waiting to be written about for over a month but, hey, I've been busy.

Back in the olden days when people actually used MSN as a standalone program2, it was also popular to have the music you were currently listening to as you status message. Some people still do, although the functionality has gone slightly out of fashion, especially since there are many more music playing and instant messaging solutions.

Of course, if you still want something that works quickly, there are many plug-ins available for certain media player and instant messenger combinations. And, in some cases, wrappers for one or the other to make them behaviour like a different media player of instant messenger so that other plug-ins will work. It was round about here I started to die inside and, when I realised that most of them form one unit that is interacting directly with both programs, I felt like curling up in a small ball and crying. Admittedly, there are reasons for doing it this way, but the end result is nearly always only going to work in one particular situation

My alternative: a locally bound socket server for the music player, which can have any number of clients connected to it. Then, when the now playing information changes, the server can inform all of the clients. The beauty of this setup is that one plug-in should ever need to be written for each program - either it's a media player, and it creates a server and sends out data, or3 it's an instant messenger, when it needs a client plug-in. At no point will I need to know what the other end actually is, as long as they all follow the same basic protocol.

So, armed with this knowledge, I set to work. Both Trillian and foobar use DLL based plug-ins as they are windows only program (yeah, I know...), and the SDKs are presented as Visual Studio projects. Despite the compiler's horrible failings, it was nice to break out the VC++ IDE again, as it probably remains the best development environment I have ever used, especially when it comes to dealing with managed programs. Oh, of course, this is assuming you can figure out how to make a project that doesn't use crazy pre-compiled headers and stuff, but still actually compiles. But Google is useful there.
Anyway, I started by relearning the windows sockets API, as the programs I was starting with are windows only, and use windows-only SDKs. The project ran around in the end, as I hit the issue that Trillian doesn't support changing the status text through the API - an issue I'm surprised hasn't caused more complaints. The foobar component is complete, and stable, to the point that I never bothered to remove the latest build from my configuration (it's intelligent enough not to do anything until it gets some clients to talk to. What struck me here, though, is the huge differences in the SDKs. This, however, is going to be the subject of a separate post, including a brief introduction to each of the SDKs.

So, overall, not that much to take away from this post. There will shortly4 be source code available for the plug-ins, and any feedback is as always welcome.

  1. Can here includes meaning "is actually worthwhile talking about". I could go on for pages and pages about either of my current actual projects (High Throughput Technologies group website over in Imperial College London, and ICFS (Internal Catalogue Filing System) for ICSF (Imperial College Science Fiction Society). But, dear god, that would be boring. As in more boring than talking to me in a pub when I'm not feeling 100%
  2. I have been informed that this is still the case. I chose to ignore this fact in favour of living in a happy dream world where people are sensible
  3. If someone makes a combined instant messenger and media player, they may deserve to be shot. Unless they have very, very good reasons
  4. I'm currently in the process of moving web spaces around, so I'll add links when I know where things will end up...