Genres added
This commit is contained in:
@@ -104,5 +104,19 @@ namespace MusicPlayer
|
||||
}
|
||||
return yearlist;
|
||||
}
|
||||
|
||||
public List<Genre> GetGenres()
|
||||
{
|
||||
List<Genre> genreslist = new List<Genre>();
|
||||
JObject o = nw.SendString("getgenres?id=hallo");
|
||||
if (o["result"].ToString() == "OK")
|
||||
{
|
||||
for (int i = 0; i < o["genres"].Count(); i++)
|
||||
{
|
||||
genreslist.Add(new Genre(o["genres"][i][0].ToString()));
|
||||
}
|
||||
}
|
||||
return genreslist;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace MusicPlayer
|
||||
{
|
||||
public class Genre
|
||||
{
|
||||
public string name { get; set; }
|
||||
public Genre(string name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,6 +43,7 @@ namespace MusicPlayer
|
||||
form.ArtistListBox.Items.Add(a.naam);
|
||||
|
||||
}
|
||||
this.api.GetGenres().ForEach(g => form.GenreListBox.Items.Add(g.name));
|
||||
}
|
||||
|
||||
public void ArtistFilter(string artist)
|
||||
@@ -54,6 +55,15 @@ namespace MusicPlayer
|
||||
});
|
||||
}
|
||||
|
||||
public void GenreFilter(string genre)
|
||||
{
|
||||
table.Clear();
|
||||
api.GetSongsByGenre(genre).ForEach(s =>
|
||||
{
|
||||
table.Add(s);
|
||||
});
|
||||
}
|
||||
|
||||
public void AlbumFilter(string album)
|
||||
{
|
||||
table.Clear();
|
||||
|
||||
@@ -89,6 +89,9 @@ namespace MusicPlayer
|
||||
|
||||
private void GenreListBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (GenreListBox.SelectedItems.Count != 0) {
|
||||
main.GenreFilter(GenreListBox.SelectedItems[0].ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private void ArtistListBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AudioHandler.cs" />
|
||||
<Compile Include="Genre.cs" />
|
||||
<Compile Include="Main.cs" />
|
||||
<Compile Include="MainForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
|
||||
Reference in New Issue
Block a user