The Artima Developer Community
Sponsored Link

.NET Buzz Forum
WMP, album art, and Amazon Web Services

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Eric Gunnerson

Posts: 1006
Nickname: ericgu
Registered: Aug, 2003

Eric Gunnerson is a program manager on the Visual C# team
WMP, album art, and Amazon Web Services Posted: Aug 4, 2003 8:42 PM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by Eric Gunnerson.
Original Post: WMP, album art, and Amazon Web Services
Feed Title: Eric Gunnerson's C# Compendium
Feed URL: /msdnerror.htm?aspxerrorpath=/ericgu/Rss.aspx
Feed Description: Eric comments on C#, programming and dotnet in general, and the aerodynamic characteristics of the red-nosed flying squirrel of the Lesser Antilles
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Eric Gunnerson
Latest Posts From Eric Gunnerson's C# Compendium

Advertisement

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.

Read: WMP, album art, and Amazon Web Services

Topic: Notes on the Naming of C# Previous Topic   Next Topic Topic: New Blogs page on the MSDN Visual Basic Developer Center

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use