public async Task<List<SongTag>> Songlist(string URI = "", string ordertype ="", List<SongTag> currentPlaylist = null)
{
string command = string.Empty;
var arguments = new List<string>();
var special = new List<string>();
switch(ordertype)
{
case ("artist"):
command = MPDKeyWords.Client.Database.LIST;
arguments.Add("artist");
break;
case ("album"):
command = MPDKeyWords.Client.Database.LIST;
arguments.Add("album");
if(!string.IsNullOrEmpty(URI))
{
arguments.Add("artist");
special.Add(URI);
}
break;
case ("genre"):
arguments.Add("genre");
if(string.IsNullOrEmpty(URI))
command = MPDKeyWords.Client.Database.LIST;
else
{
command = MPDKeyWords.Client.Database.FIND;
special.Add(URI);
}
break;
case ("find"):
command = MPDKeyWords.Client.Database.FIND;
arguments.Add("album");
special.Add(URI);
break;
case ("search"):
command = MPDKeyWords.Client.Database.SEARCH;
arguments.Add("any");
special.Add(URI);
break;
default:
command = MPDKeyWords.Client.Database.LSINFO;
special.Add(URI);
break;
}
var qId = await Send(command, arguments, special);
var response = await MPDKeyWords.Response.Encode(await Response(qId));
var songlist = new List<SongTag>();
for (int i = 0; i < response.Count; i++ )
songlist.Add(new SongTag(response[i], i));
return songlist;
}