This is day 3 of the project posts, which is impressive… I have a hard time focussing enough to figure out how I\’m going to make this a project based website. Todays project of choice was: www.893archive.org
893archive.org is a site that Dan wanted to create after a similiar site went down. It\’s purpose is to record the play history of a local public radio station known as \"The Current\". Dan had sent me an email asking me for a series of things (DNS, oxwaf, etc) and because of that I sort of got wrapped up in the process. Although Dan did the site design and 99.9% of the coding, I helped to bring the google ads and the amazon ads with little to no hassel.
Although there is still some cleanup to be done, most of the site is completed now, and available to the public.
Let\’s talk about some of the site\’s innovation. Dan wrote the code to actually build the list, so I\’m not going to talk about that here… What I will talk about though is how we go about getting the amazon data. As you can tell, many of the songs don\’t have amazon data, so this applies only to the ones it works on.
Ok here goes.
Amazon provides a service for lookup called \"ECS\". It allows people to query their website for data about a product. In this case, we are looking for information about a cd album based on the title of the song.
ECS has a few problems though… You can\’t query by artist and song (as far as we can tell), only one or the other. Because song titles are used by more than one artist, and artists don\’t release just one album, this poses a very large problem.
To get around this, we query for the title of a song against the database, and then search within those results for the name of an artist… It just hit me now that it might be better to go the other direction, so I might have to go implement that now. In either case, the code to get the information looks something like this:
$url2 = \"webservices.amazon.com SUBSCRIPTION_ID .\"&Operation=ItemSearch&SearchI- ndex=MusicTracks&Keywords=\". urlencode($track[\"title\"]) .\"&ResponseGroup=Large\";
$data = file_get_contents($url2);
pretty simple code if you ask me… Of course, that $data is in xml, so you have to parse your way though the search results. In either case though, it makes life pretty simple. Needless to say, it was a pretty cool day long project, and if we can get decent traffic to the site, we might even make some money. Here\’s hoping.