private void songInfoToolStripMenuItem_Click(object sender, EventArgs e) { foreach (ListViewItem item in lstSongs.SelectedItems) { int it = item.Index; Song song = Artists.getTotalValue(it); Form2 data = new Form2(); data.update(song.getName(), song.getArtist().getName(), song.getAlbum().getName(), song.getAlbumIndex().ToString(), song.getYear().ToString()); data.ShowDialog(); song.setName(data.SongName); Artist art = changeArtist(data.SongArtist); song.setArtist(art); //Change only for the song Album alb = changeAlbum(data.SongAlbum, art); song.setAlbum(alb); //Change only for the album uint indexer = touInt(data.Index); song.setAlbumIndex(indexer); uint yeari = touInt(data.Year); song.setYear(yeari); lstSongs.Items.Clear(); drawOnSongList(); } }
private void songInfoToolStripMenuItem_Click(object sender, EventArgs e) { foreach (ListViewItem item in lstSongs.SelectedItems) { System.IO.Stream albumResponseStream; int it = item.Index; Song song = Artists.getTotalValue(it); Form2 data = new Form2(); data.update(song.getName(), song.getArtist().getName(), song.getAlbum().getName(), song.getAlbumIndex().ToString(), song.getYear().ToString()); data.ShowDialog(); song.setName(data.SongName); Artist art = changeArtist(data.SongArtist); song.setArtist(art); //Change only for the song Album alb = changeAlbum(data.SongAlbum, art); song.setAlbum(alb); //Change only for the album uint indexer = touInt(data.Index); song.setAlbumIndex(indexer); uint yeari = touInt(data.Year); song.setYear(yeari); lstSongs.Items.Clear(); drawOnSongList(); if (data.Sync == true) { try { string API_KEY = "3d0dcf1274bfd9661a56e69161c405e1"; string API_SECRET = "67f9285e92ec64c788ad56cf6cb5a27d"; Session session = new Session(API_KEY, API_SECRET); Lastfm.ProxySupport.Proxy = new System.Net.WebProxy("221.2.216.38", 8080); // Test it out... Track track = new Track(art.getName(), song.getName(), session); //Console.WriteLine(track.Title + ", "+ track.Artist.Name + ", " + track.GetAlbum().Name); //Set Metadata song.setName(track.Title); Artist LastArtist = changeArtist(track.Artist.Name); //Image for Artist System.Net.WebRequest artistRequest = System.Net.WebRequest.Create(track.Artist.GetImageURL()); System.Net.WebResponse artistResponse = artistRequest.GetResponse(); System.IO.Stream artistResponseStream = artistResponse.GetResponseStream(); Image img = Image.FromStream(artistResponseStream); LastArtist.SetImage(new Bitmap(img, new Size(50, 50))); song.setArtist(LastArtist);//Change only for the song Album LastAlbum = changeAlbum(track.GetAlbum().Name, LastArtist); //Image for Album System.Net.WebRequest albumRequest = System.Net.WebRequest.Create(track.GetAlbum().GetImageURL()); System.Net.WebResponse albumResponse = albumRequest.GetResponse(); albumResponseStream = albumResponse.GetResponseStream(); LastAlbum.SetBitImage(new Bitmap(albumResponseStream)); song.setAlbum(LastAlbum);//Change only for the album //uint LastIndex = touInt(track.); //song.setAlbumIndex(indexer); //uint LasyYear = touInt(track.GetAlbum().; //song.setYear(yeari); } catch { } } //Edit File Metadata TagLib.File tip = TagLib.File.Create(song.getURL()); tip.Tag.Title = song.getName(); #pragma warning disable CS0618 // El tipo o el miembro están obsoletos tip.Tag.Artists[0] = song.getArtist().getName(); #pragma warning restore CS0618 // El tipo o el miembro están obsoletos tip.Tag.Album = song.getAlbum().getName(); tip.Tag.Year = song.getYear(); tip.Tag.Track = song.getAlbumIndex(); try{ tip.Save(); } catch { } lstSongs.Items.Clear(); drawOnSongList(); } }