private void searcher_Click(object sender, EventArgs e) { string ApiKey = "****************************"; string LastFMLogin = "**************"; Lastfm.Services.Session session = new Lastfm.Services.Session(ApiKey,LastFMLogin); Lastfm.Services.Artist lArtist = new Lastfm.Services.Artist(artist2.Text,session); Lastfm.Services.Album lAlbum = new Lastfm.Services.Album(lArtist,album2.Text,session); textBox5.Text = AbsUrlOfArt(album2.Text, artist2.Text); p5.ImageLocation = textBox5.Text; } private void set_Click(object sender, EventArgs e) { TagLib.File f6 = TagLib.File.Create(path2[songlist.SelectedIndex]); IPicture[] pictures = new IPicture[1]; pictures[0] = new Picture(p5.ImageLocation); f6.Tag.Pictures = pictures; } public static string AbsUrlOfArt(string album, string artist) { string ApiKey = "****************************"; string LastFMLogin = "**************"; Lastfm.Services.Session session = new Lastfm.Services.Session(ApiKey,LastFMLogin); Lastfm.Services.Artist lArtist = new Lastfm.Services.Artist(artist, session); Lastfm.Services.Album lAlbum = new Lastfm.Services.Album(lArtist, album, session); return lAlbum.GetImageURL(AlbumImageSize.ExtraLarge); } public static System.Drawing.Image AlbumArt(string album, string artist) { Stream stream = null; try { WebRequest req = WebRequest.Create(AbsUrlOfArt(album, artist)); WebResponse response = req.GetResponse(); stream = response.GetResponseStream(); Image img = Image.FromStream(stream); return img; } catch (Exception e) { return null; } finally { if (stream != null) stream.Dispose(); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)