WMP, album art, and Amazon Web Services


So, I'm working on a music playing application (to be revealed sometime around PDC,
or perhaps a bit later if I don't get it working) to play around with Whidbey features.
One of the things I want to do is be able to display the album art.

So, I dust off the docs for WMP - which are a bit spotty in places - and go searching
for the album art. For a media item in WMP, you can fetch various attributes, and
one of them is WM/CoverArt (or something like that). Seems like just the ticket, but
none it's not set for any of the items in my collection.

I go searching for another way to get the art. There's a MoreInfo attribute that you
can fetch for all the items, but it points to a non-existant page. I play around a
bit more and find that I can fix the URL to get to the "More Info" page, which has
a link to the album art. A quick Regex, and I pull the cover art url out. I code it
up, and run it on a small subset of my album selection (about 20 albums). There is
no album art for 5 of the 20 albums.

That's pretty pathetic. It's not like I had a lot of obscure albums there - they were
all albums that had certified at least platinum. Now, it may not have had all the
albums, but it was really slow, so I had that going for me.

A bit of time on Google led me towards Amazon
web services
.  The SDK is free, and using it is free, as long as you
don't do more than 1 request a second per application (multiple instances can do more).
The Details object has a link to the album art, so I just needed to get that object
for the album. So, I started up VS, added the WSDL as a web reference, and went to
town.

The first attempt was to use keyword searching. That worked well if I as looking for
something like "Green Day Dookie", but something like "rush rush" gives you 282 matches,
some in artist, some in album. The basic problem is that you're just looking at keywords,
and you can't specify album and artist directly. Nor can you find that in the Details
object - it just has a single property named ProductName.

The solution was to do an Artist search. This gives me all albums with a specific
value in the artist field (once again, a keyword search, not an exact search). You
then need to look through all the matches you got back and match against the album
you want. This works, but is a bit ungainly, but at least you don't need to do it
that often.

Here's some code:

			ArtistRequest request = new ArtistRequest();
			request.artist = albumCoverArt.Artist;
			request.devtag = ericsDevtag;
			request.mode = "music";
			request.type = "lite";
			request.page = "1";

			AmazonSearchService search = new AmazonSearchService();

			ProductInfo productInfo = null;
			productInfo = search.ArtistSearchRequest(request);

    

That gets the first chunk of data, and you have to make other calls 1 second apart
to get the rest. The devtag is given to you when you register with Amazon, and it
identifies who's using the service.

Comments (4)

  1. Rob Chartier says:

    Another decent idea is to do a HTTP Scrap of Google Images and rip out the first image off the page. Fairly simple and you typically get a sub-second response with it. It does give some pretty unexpected results when your meta information for the song isnt all that accurate.

  2. Eric –
    check the http://www.sprote.com/clutter/ – Clutter is the mac OSX apps that aparently uses amazon to get album cover images
    The app is beautiful – no skin just cd cover and mp3 or cd player behind

  3. Antony Brooke-Wood says:

    I was wondering if you know where the hell WMP actually stores the Album Art. I know if you add an image called Folder.jpg it will use that instead, but what about when it adds the image automatically?

Skip to main content