async void chimneyMpdServer_OnCurrentSong(object sender, ResponseEventArgs e)
{
string response = string.Empty;
if (!current_state.Equals("stop"))
{
//var currentSonga = await Dbconnection.QueryAsync<CurrentPlaylist>("SELECT * FROM CurrentPlaylist WHERE CurrentSong = 0");
var currentSong = (await Dbconnection.QueryAsync<CurrentPlaylist>("SELECT * FROM CurrentPlaylist WHERE CurrentSong = 1")).FirstOrDefault<CurrentPlaylist>();
if (currentSong != null)
{
if (currentSong.IsUri)
{
response += "file: " + currentSong.Uri;
response += "Pos: " + currentSong.PositionId;
}
else
{
var currentFile = await Dbconnection.FindAsync<File>(o => o.FileId == currentSong.FileId);
if (currentFile != null)
{
currentFile.Pos = currentSong.PositionId;
response += currentFile.ToResponseString();
}
}
}
}
chimneyMpdServer.AppendResponse(response, e.id, e.position);
}