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(); } }
public void drawOnSongList() { lstSongs.Items.Clear(); lstSongs.View = View.Details; for (int i = 0; i < Artists.getLength(); i++) { Artist art = Artists.getValue(i); for (int j = 0; j < art.getAlbums().getLength(); j++) { Album alb = art.getAlbums().getValue(j); for (int k = 0; k < alb.getSongs().getLength(); k++) { Song file = alb.getSongs().getValue(k); TagLib.File data = TagLib.File.Create(file.getURL()); ListViewItem song = new ListViewItem(file.getName()); Console.WriteLine(file.getName()); lstSongs.Items.Add(song); song.SubItems.Add(setTime(data.Properties.Duration.ToString())); song.SubItems.Add(file.getArtist().getName()); song.SubItems.Add(file.getAlbum().getName()); song.SubItems.Add(file.getYear().ToString()); song.SubItems.Add(""); } } } }
public void playPrev() { Song now = songQueue.peek(); songQueue.empty(); if (mode == 2) //Song Mode { int index = Songs.getIndex(now); if (index != 0) { for (int i = index - 1; i < lstSongs.Items.Count; i++) { Song data = Songs.getValue(i); enqueueSong(data.getArtist().getName(), data.getAlbum().getName(), data.getName()); } } } else if (mode == 0)//Artist mode { int index = now.getArtist().getTotalIndex(now.getName()); if (index != 0) { for (int i = index - 1; i < listView1.Items.Count; i++) { String art = listView1.Items[i].SubItems[3].Text; String alb = listView1.Items[i].Group.Header; String nam = listView1.Items[i].SubItems[0].Name; Console.WriteLine(art + "," + alb + "," + nam); enqueueSong(art, alb, nam); } } } else if (mode == 1)//Album mode { int index = now.getAlbum().getSongs().getIndex(now); if (index != 0) { for (int i = index - 1; i < listView2.Items.Count; i++) { ListViewItem lista = listView2.Items[i]; enqueueSong(lista.SubItems[3].Text, lista.SubItems[4].Text, lista.SubItems[1].Text); } } } if (songQueue.getLength() != 0) { playSong(); } }
private void playSong() { Console.WriteLine("Play:" + songQueue.peek().getName()); if (songQueue.getLength() != 0) { Song song = songQueue.peek(); String dic = song.getURL(); Player.URL = dic; lblSong.Text = (song.getName() + "\n" + song.getArtist().getName() + "\n" + song.getAlbum().getName()); MemoryStream ms = new MemoryStream(getImage(dic).Data.Data); Image img = Image.FromStream(ms); Bitmap b = new Bitmap(img, new Size(40, 40)); MemoryStream ms2 = new MemoryStream(); b.Save(ms2, System.Drawing.Imaging.ImageFormat.Jpeg); lblSong.Image = b; Player.Ctlcontrols.play(); } }
public void drawOnAlbumSongList(ListViewItem lista) { listView2Mode = "song"; listView2.Items.Clear(); listView2.View = View.Details; Album alb = Albums.searchAlbum(lista.Text); for (int i = 0; i < alb.getSongs().getLength(); i++) { Song file = alb.getSongs().getValue(i); TagLib.File data = TagLib.File.Create(file.getURL()); ListViewItem song = new ListViewItem((i + 1).ToString()); song.SubItems.Add(file.getName()); song.SubItems.Add(setTime(data.Properties.Duration.ToString())); song.SubItems.Add(file.getArtist().getName()); song.SubItems.Add(file.getAlbum().getName()); listView2.Items.Add(song); } }
public void drawOnSongList() { lstSongs.Items.Clear(); lstSongs.View = View.Details; for (int i = 0; i < Songs.getLength(); i++) { Song file = Songs.getValue(i); TagLib.File data = TagLib.File.Create(file.getURL()); ListViewItem song = new ListViewItem(file.getName()); lstSongs.Items.Add(song); song.SubItems.Add(setTime(data.Properties.Duration.ToString())); song.SubItems.Add(file.getArtist().getName()); song.SubItems.Add(file.getAlbum().getName()); song.SubItems.Add(file.getYear().ToString()); song.SubItems.Add(file.getRating()); } }
//Search private void toolStripButton6_Click(object sender, EventArgs e) { AlbumForArtist.Images.Clear(); Searches.Visible = true; String search = toolStripTextBox2.Text; ArtistList artList = toServer.getSearchedArtist(search); AlbumList albList = toServer.getSearchedAlbum(search); List songList = toServer.getSearchedSong(search); //Artists for (int i = 0; i < artList.getLength(); i++) { Artist artist = artList.getValue(i); ListViewItem art = new ListViewItem(artist.getName(), i, listView3.Groups[0]); AlbumForArtist.Images.Add(artist.GetImage()); art.Text = artist.getName(); listView3.Items.Add(art); } //Albums for (int i = 0; i < albList.getLength(); i++) { Album album = albList.getValue(i); ListViewItem art = new ListViewItem(album.getName(), (artList.getLength() - 1 + i), listView3.Groups[1]); AlbumForArtist.Images.Add(album.GetBitImage()); art.SubItems.Add(album.getArtist().getName()); art.Text = album.getName(); listView3.Items.Add(art); } //Songs for (int i = 0; i < songList.getLength(); i++) { Song song = songList.getValue(i); ListViewItem art = new ListViewItem(song.getName(), (artList.getLength() - 1 + albList.getLength() - 1 + i), listView3.Groups[2]); AlbumForArtist.Images.Add(song.getAlbum().GetBitImage()); art.SubItems.Add(song.getArtist().getName()); art.SubItems.Add(song.getAlbum().getName()); art.Text = song.getName(); listView3.Items.Add(art); } }
private void toolStrip3_ItemClicked_1(object sender, ToolStripItemClickedEventArgs e) { //SongOrAlbumLV1 = false; listView1.FullRowSelect = true; listView1.Groups.Clear(); listView1.Items.Clear(); AlbumForArtist.Images.Clear(); listView1.Visible = true; ToolStripItem var = e.ClickedItem; Console.WriteLine(var.Name); Artist art = Artists.searchArtist(var.Name); for (int i = 0; i < art.getAlbums().getLength(); i++) { Album alb = art.getAlbums().getValue(i); AlbumForArtist.Images.Add(alb.GetBitImage()); ListViewGroup albumArt = new ListViewGroup(alb.getName(), HorizontalAlignment.Left); albumArt.Name = alb.getName(); listView1.Groups.Add(albumArt); Console.WriteLine("album" + listView1.Groups[i].Name); //listView1.Items.Add(new ListViewItem("", i,albumArt)); #Tried to display image for (int j = 0; j < alb.getSongs().getLength(); j++) { Song song = alb.getSongs().getValue(j); ListViewItem songArt = new ListViewItem(song.getName(), albumArt); songArt.Name = song.getName(); albumArt.Items[j].Text = song.getAlbumIndex().ToString(); songArt.SubItems.Add(song.getName()); songArt.SubItems.Add(setTime(TagLib.File.Create(song.getURL()).Properties.Duration.ToString())); songArt.SubItems.Add(song.getArtist().getName()); Console.WriteLine("song" + albumArt.Items[j].Name); listView1.Items.Add(songArt); } } }
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(); } }