/ Published in: C#
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
if (trackName != null && artistName != null) { //Get track info //LastFmLib.API20.Types.ArtistInfo suspectArtist = new LastFmLib.API20.Types.ArtistInfo(); //suspectArtist.Name = "something"; suspect.Title = trackName; try { //detective.Limit = 1; detective.Start(); if (detective.succeeded) { //for now just list the results foreach (LastFmLib.API20.Types.Track sparkle in detective.Result.Tracks) { Console.WriteLine(); Console.WriteLine("And the result is: A: " + sparkle.ArtistName + " T: " + sparkle.Title + " L: " + sparkle.NumListeners); Console.WriteLine(); } } } catch (Exception e) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(); Console.WriteLine("Error: {0}", e.ToString()); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.White; } Console.WriteLine("Something good should happen here"); Console.WriteLine("Artist: " + artistName + " Track: " + trackName); } else { //Give error Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(">< Error: Not enough track data was provided ><"); Console.ForegroundColor = ConsoleColor.White; if (debug) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("The track name or artist name were missing."); Console.WriteLine("Please check the output of the XML."); Console.ForegroundColor = ConsoleColor.White; } }