diff --git a/MusicPlayer/MusicPlayer/APIHandler.cs b/MusicPlayer/MusicPlayer/APIHandler.cs index a436322..af89f97 100755 --- a/MusicPlayer/MusicPlayer/APIHandler.cs +++ b/MusicPlayer/MusicPlayer/APIHandler.cs @@ -55,7 +55,8 @@ namespace MusicPlayer dynamic songs = o["songs"]; for (int i = 0; i < songs.Count; i++) { - songslist.Add(new Song(songs[i][0].ToString(), songs[i][3].ToString(), songs[i][5].ToString(), songs[i][4].ToString(), songs[i][1].ToString(), (int)songs[i][9], this)); + if(songs[i][2].ToString().EndsWith(".mp3")) + songslist.Add(new Song(songs[i][0].ToString(), songs[i][3].ToString(), songs[i][5].ToString(), songs[i][4].ToString(), songs[i][1].ToString(), (int)songs[i][9], this)); } } return songslist; diff --git a/MusicPlayer/MusicPlayer/MainForm.Designer.cs b/MusicPlayer/MusicPlayer/MainForm.Designer.cs index 86b7ef1..e70a4a5 100644 --- a/MusicPlayer/MusicPlayer/MainForm.Designer.cs +++ b/MusicPlayer/MusicPlayer/MainForm.Designer.cs @@ -173,10 +173,10 @@ // // SplitContainer.Panel1 // - this.SplitContainer.Panel1.Controls.Add(this.PlaylistBox); this.SplitContainer.Panel1.Controls.Add(this.AlbumListView); this.SplitContainer.Panel1.Controls.Add(this.ArtistListBox); this.SplitContainer.Panel1.Controls.Add(this.GenreListBox); + this.SplitContainer.Panel1.Controls.Add(this.PlaylistBox); // // SplitContainer.Panel2 // @@ -225,12 +225,11 @@ // // PlaylistBox // - this.PlaylistBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); + this.PlaylistBox.Dock = System.Windows.Forms.DockStyle.Fill; this.PlaylistBox.FormattingEnabled = true; - this.PlaylistBox.Location = new System.Drawing.Point(3, 3); + this.PlaylistBox.Location = new System.Drawing.Point(0, 0); this.PlaylistBox.Name = "PlaylistBox"; - this.PlaylistBox.Size = new System.Drawing.Size(757, 121); + this.PlaylistBox.Size = new System.Drawing.Size(760, 131); this.PlaylistBox.TabIndex = 4; this.PlaylistBox.Visible = false; // diff --git a/MusicPlayer/MusicPlayer/MainForm.cs b/MusicPlayer/MusicPlayer/MainForm.cs index 6433ea4..0a8bd1b 100644 --- a/MusicPlayer/MusicPlayer/MainForm.cs +++ b/MusicPlayer/MusicPlayer/MainForm.cs @@ -68,7 +68,6 @@ namespace MusicPlayer main.audio.Stop(); } - private void UpdateTimer_Tick(object sender, EventArgs e) { //Trackbar @@ -88,13 +87,13 @@ namespace MusicPlayer LabelTotalTime.Text = Main.SecondsToTimestamp(main.audio.TotalTime); //Current song label - if(main.audio.CurrentSong == null) + if (main.audio.CurrentSong == null) CurrentSongLabel.Text = "Not playing any songs"; else CurrentSongLabel.Text = "Currently playing: " + main.audio.CurrentSong.Name; //Buttons and context menu - if(main.audio.AState == AudioHandler.AudioState.PLAYING) + if (main.audio.AState == AudioHandler.AudioState.PLAYING) { PlayButton.Enabled = false; NotifyMenuStripPlayButton.Enabled = false; @@ -139,15 +138,13 @@ namespace MusicPlayer StopButton.Enabled = true; NotifyMenuStripStopButton.Enabled = true; } - - - } private void GenreListBox_SelectedIndexChanged(object sender, EventArgs e) { - if (GenreListBox.SelectedItems.Count != 0) { - main.GenreFilter(GenreListBox.SelectedItems[0].ToString()); + if (GenreListBox.SelectedItems.Count != 0) + { + main.GenreFilter(GenreListBox.SelectedItems[0].ToString()); ArtistListBox.ClearSelected(); AlbumListView.SelectedIndices.Clear(); } @@ -176,22 +173,22 @@ namespace MusicPlayer private void SongsTableView_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { SongsTable s = new SongsTable(); - if(SongsTableView.SelectedRows.Count > 0) + if (SongsTableView.SelectedRows.Count > 0) { var drv = SongsTableView.SelectedRows[0].DataBoundItem as DataRowView; var row = drv.Row as DataRow; s.ImportRow(row); main.audio.Play((s.Rows[0][5] as Song)); } - + } private void PositionTrackBar_ValueChanged() { - if(!clicked) + if (!clicked) main.audio.Seek(PositionTrackBar.Value); - LabelCurrentTime.Text = Main.SecondsToTimestamp((int)(((double)PositionTrackBar.Value/1000) * main.audio.CurrentSong.Seconds)); + LabelCurrentTime.Text = Main.SecondsToTimestamp((int)(((double)PositionTrackBar.Value / 1000) * main.audio.CurrentSong.Seconds)); } private void NotifyIcon_Click(object sender, EventArgs e)