Armwrestling Javascript for fun.

It’s a sad fact that I spend more time listening to music under Windows (and therefore Winamp) than I do on the Linux box at work that used to feed the “Current Music” feature on this page. The time came for a change. The desire to show off my eclectic music collection was unfulfilled, and I had to do something about it!

I found several options, such as DoSomething or finding a way to shim SpyAmp into the site, but I finally settled on BlogAmp. It worked right out of the box, but I wasn’t quite happy. If you look at the BlogAmp site you can see that its music display is quite cool, including clever hover boxes containing the extra data. The default look is just a text dump of title, bitrate and played-time data. Bah!

While poking around I came across references to the acronym tag in HTML, a tag I just now used quite shamelessly to show how it works. It occurred to me… eventually… that I could use it to show the data I wanted in a tooltip.

It sounds easy enough, but I’ve also never dabbled in Javascript before. Learning how to script the output I wanted took the better part of two more hours. (Sad, I know.) At least an hour was spent just looking for a premade function that would convert the raw number of seconds provided by BlogAmp into a nice minutes:seconds display. In the end I just went looking for math syntax references and brute-forced the display.

The end result sits near the end of the left-side column: a list of played songs that you can mouse-over to find out how long the track is and when I listened to it. Hooray, or something.

Do you want to know the really sad part? Of course you do. The really sad part is that I sat down four or five hours ago with the intention of ripping some Ogg Vorbis tracks. So far I haven’t so much as touched CDEX tonight.

Oh well. Tomorrow is another day. I did learn stuff, and I did achieve the results I wanted from BlogAmp. Yay!