About a year ago, I started to work on some code to include a “now playing” feature here. It would track music I was listening to in my media player (Winamp, at the time), and put the info in the sidebar of this site. I looked at various canned code solutions, but I usually like doing these things myself. But it wasn’t a high priority, so I just tinkered with it here and there, and never really finished it up.
Since then, I’ve changed jobs, moved into a new house, switched from Winamp to iTunes, and I generally have had less free time available. So the unfinished PHP code sat on my server’s drive collecting dust for quite a while. Recently, while poking through my files looking for something else, I spotted the old files, and it revived my interest. So, over the last week or so, I tinkered with it some more during short breaks, and finally got it working well enough to throw something up.
You can see the results near the top of the sidebar, under the new “Media” heading (I plan to add books and movies, eventually). It will only show songs for which it can locate an Amazon.com product, so it won’t reflect my full musical selection (though the other songs are still tracked in the database, and I might expose those at some point). If the selection is preceded by “Currently”, then I was listening to that selection at the time you loaded the page. If it says “Recently”, then it’s showing the last song I listened to, and I’ve either shut down iTunes, or it couldn’t locate my current song on Amazon.
The hardest part about getting it working was locating a decent free plugin for iTunes to transmit the song info to my server. I finally settled on AMIP. AMIP is geared more for hooking into an IRC or IM client, but it’s capable of calling out to external programs, and the docs show examples of using cURL to transmit information to a web server. For the Amazon integration, I used the AmazOOP PHP library.
Maybe one day, I’ll clean up the code and make it available. But right now, it’s very messy, full of unused variables and hardcoded HTML markup, and the database isn’t normalized, so I’d be embarassed for anybody else to look at it. I also want to capture some more data in the database (mainly my iTunes rating for each song) before I’m done.
In the interest of full-discosure, if you click on the links to Amazon, and purchase something, I’ll get a small kickback. Obviously, I encourage you to do so ![]()















11 Comments
that’s sweet man. would be cool to aggregate “currently listening” data from thousands of people simultaneously and pop it into a sidebar on amazon.com.
For aggregated music listening info, see also: audioscrobbler.
I use a combination of audioscrobbler a hosted script and a teeny tiny bit of html…
The nicest thing about audioscrobbler is the great ranking system they have for your tunes… after a few months you can get fairly accurate recommendations of new music you may like to check out.
That is exactly what I’ve been looking for. I hope you can make it available someday.
I was going to use my audioscrobbler feed originally, but I’ve been getting inconsistent results from their XML feed. For instance, sometimes it doesn’t include the album name (even though it exists in the track ID3 info on my end). That puts a serious kink in the usage. I haven’t figure out yet why it does that sometimes, and sometimes not. Plus, the servers tend to get bogged down, and the information is rarely close to real-time.
P.O.D.
Niiiiice…
Did you know that there is a iTunsspy plugin that works with Wordpress ?
http://www.crea-doo.at/itunesspy/
Don’t be embaressed to let people see your code. It’s people like you who open blogging up to the mainstream public that it’s become. Anything that improves the way that we can inform others of what we’re doing and what we’re up to is a bonus on any blog!
Check out our work here: http://www.gerpok.com
So, Dougal, what is your Audioscrobbler username?
I’m thinking that you could probably guess my username
3 Trackbacks
[...] Update: Here is another plugin which results in the same effect. Now playing… [...]
[...] I’m interested in coming up with a good metadata system for describing various sorts of media. Obviously, this ties in to my recent work on my “now playing” feature, and also into my interest in microformats. And I plan to expand this with links to books, DVDs, and perhaps other media or products. I asked about it on the microformats-discuss mailing list, and they pointed me to a page on the wiki about media-metadata. [...]
[...] sure were okay, gradually working down to the likely culprits. Until I finally found it. It was my Now Playing widget, which I had recently (and hastily) refactored. Arg! It was my own fault that I had been [...]