From 651f8d93e504a07b92954fc06dd1dbed7300d0a2 Mon Sep 17 00:00:00 2001 From: Bob van Loosen Date: Wed, 26 Dec 2012 22:47:02 +0100 Subject: [PATCH] added: hide text if mpd is muted --- src/mpdclient.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/mpdclient.cpp b/src/mpdclient.cpp index 5320fde..6e77460 100644 --- a/src/mpdclient.cpp +++ b/src/mpdclient.cpp @@ -141,6 +141,7 @@ bool CMpdClient::GetPlayStatus() data.Clear(); bool isplaying = false; + bool muted = false; while(1) { if (m_socket.Read(data) != SUCCESS) @@ -162,15 +163,25 @@ bool CMpdClient::GetPlayStatus() string word; if (GetWord(tmpline, word)) { - if (word == "state:" && GetWord(tmpline, word)) + if (word == "state:") { - if (word == "play") - isplaying = true; + if (GetWord(tmpline, word)) + if (word == "play") + isplaying = true; + } + else if (word == "volume:") + { + if (GetWord(tmpline, word)) + if (word == "0") + muted = true; } } if (line == "OK") { + if (muted) + isplaying = false; + CLock lock(m_condition); if (m_isplaying == false && isplaying == true) m_playingchanged = true;