I made my albumCollection.php class versatile enough that it was easy to just crank out an album cover gallery. I spent most of my time in the last 24 hours fixing up the csv file so that the maximum number of album covers can be found in Amazon.com. It still doesn’t find them all and it gets a few wrong, but it does a pretty good job all things considered. With all the requests cached it loads fast enough, but I wonder how it will perform in a weeks time when it needs to re-fetch data.
Update: the PHP code used to make this gallery and other web mashups is available for download as open source.
I’ve thought about only showing say 100 CD covers, or starting with a random one, but right now it displays as many as it can find.
One thing the gallery is good for, is showing which albums have good graphic design. The album cover is recognizable, the title or artist name stands out. You can also see how the change to CD has changed album cover design. Now text often takes up more space, though some people still design album covers the old fashioned way. You can also see how the early days of desktop publishing in the 80s affected album cover design.
One annoyance is Firefox, at least on the Mac, it doesn’t render the way I want. The Last.fm Records plugin has the same issue. I put every album in a
LI tag and inside that is a
link and an
image tag. I set all the borders, padding, and margin to be zero, but still in Firefox it leaves a gap of a few pixels. I’ve tried a few things, but if anyone has a quick fix for this I’d appreciate it.
My cover gallery only uses the Amazon Product API but I created the albumCollection class in such a way that it can interact with five APIs: Amazon Product API, Last.FM, Facebook, iTunes Music Store, and Twitter. The first two are the most deeply integrated, I spent a long time looking for PHP APIs or SDKs or at least example code, with less than stellar results. In fact the state of Amazon PHP code, caused me to create a much more elaborate Object Oriented solution than I needed just to show that it can be done. Amazon by far gave me the most trouble and it is still giving me grief.
Last.FM has a really elaborate API and a fan created PHP class to access it. For the most part it works, but Last.fm didn’t give me the information I wanted quickly so I turned to Amazon. Facebook has its own PHP SDK which I barely use, I also barely use Vadim’s library. I found out the less code I used from other people, the better things seem to go. I just create my own search string, then use CURL, then parse the results. I let my client code do most of the formatting, that way my class can be used for a few different purposes. I’m working on a mashup and plan to make another after going through all the trouble I did groking various APIs.