Muschamp Rd

Creating an album cover gallery

September 28th, 2010
PHP logo

After my epic and still ongoing battle with PHP and WordPress I decided that I might as well do something at least a little unique and creative with PHP, APIs, RSS, and whatever else. I keep tweaking my sidebar, despite an obvious bug in the WordPress main codebase, I added some more Web 2.0-esque features to formerly static pages on Muschamp.ca and while doing this and the whole hoopla over Apple’s ping social network I decided to do something with my music collection.

Update: I ended up making more than just a simple album cover gallery, and it is still an idea I revisit, so I included a screenshot of one of my later versions. Code to make a gallery like this from your own music collection is available as open source.

CD Cover Gallery example
I wrote how I entered a lot of books I’ve read into Goodreads and now can manipulate that data in a Web 2.0 way. Well after my friend’s house got broken into and his CD collection was robbed I’ve been keeping a list of every CD I own online as if you have such a list and the correct insurance policy, you get your entire collection replaced, not just 50 random CDs or whatever the policy defaults too. In addition to CDs, at some point I typed out a list of my old cassette tapes, even LPs and 45s. These were originally text files but I added them to my website at some point…

This was all fine and dandy in the Web 1.0 world, but in 2010 you have to do something cool with your data, so I thought why not use Last.fm to display the album covers rather than just list what albums I’ve collected over the years? Alas the Last.fm API doesn’t really support this, so after much Googling I learned I could do this with the Amazon Product Advertising API, alas it has undergone changes and there is some bad code examples out there.

Due to its omnipresence I was forced to use PHP, so you’d think with PHP and the Amazon API and a Bachelors Degree in Computer Science this would be easy, well it wasn’t. Amazon isn’t so interested in their Product Advertising API anymore, they’re more interested in promoting their other web services. They also upped the complexity of the requests which was maybe too much for some PHP coders. Luckily not all PHP coders are created equal and I finally found someone with a working example that I could adapt how I wanted in a couple hours. Other “APIs” I tried were even buggier and frustrating to work with.

Sameer Borate seems to get Object Oriented Development, PHP, and writing sensible, reuse-able (by others) code. He might have even made unit tests which would make my old mentor proud. The other hero of the PHP Amazon API world is named Ulrich Mierendorff most everyone seems to use his aws_signed_request.php function. I however use Sameer’s slightly modified version as my webhost doesn’t like calls to file_get_contents() among many things restricted in the PHP installation.

So now that I got a simple test gallery working, I just have to convert my unordered lists to CSV files, add some iFrames to my existing static HTML pages, and then voila snazzy online music collection gallery. Maybe I should try and use Amazon Product API to make money, but I just don’t get that many visitors to my domain…


Posts on Muskblog © Andrew "Muskie" McKay comments not necessarily so...
CFA Institute does not endorse, promote or warrant the accuracy or quality of Muskblog. CFA® and Chartered Financial Analyst® are registered trademarks owned by CFA Institute.