fixed: don't disconnect if mpd doesn't send artist or title info
This commit is contained in:
parent
b74fc88fb7
commit
8234535ffb
1 changed files with 12 additions and 6 deletions
|
@ -93,19 +93,25 @@ bool CMpdClient::GetCurrentSong()
|
|||
if (datastream.fail())
|
||||
break;
|
||||
|
||||
string tmpline = line;
|
||||
string word;
|
||||
if (GetWord(line, word))
|
||||
if (GetWord(tmpline, word))
|
||||
{
|
||||
if (word == "Artist:")
|
||||
artist = line.substr(1);
|
||||
artist = tmpline.substr(1);
|
||||
else if (word == "Title:")
|
||||
title = line.substr(1);
|
||||
title = tmpline.substr(1);
|
||||
}
|
||||
|
||||
if (!artist.empty() && !title.empty())
|
||||
if (line == "OK")
|
||||
{
|
||||
string song = artist + " - " + title;
|
||||
SetCurrentSong(song);
|
||||
if (artist.empty())
|
||||
artist = "Unknown artist";
|
||||
|
||||
if (title.empty())
|
||||
title = "Unknown title";
|
||||
|
||||
SetCurrentSong(artist + " - " + title);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue