|
a/upmpd/mpdcli.cxx |
|
b/upmpd/mpdcli.cxx |
|
... |
|
... |
91 |
return false;
|
91 |
return false;
|
92 |
}
|
92 |
}
|
93 |
return true;
|
93 |
return true;
|
94 |
}
|
94 |
}
|
95 |
|
95 |
|
|
|
96 |
int MPDCli::getVolume()
|
|
|
97 |
{
|
|
|
98 |
updStatus();
|
|
|
99 |
return m_stat.volume == -1 ? 0: m_stat.volume;
|
|
|
100 |
}
|
|
|
101 |
|
96 |
bool MPDCli::updStatus()
|
102 |
bool MPDCli::updStatus()
|
97 |
{
|
103 |
{
|
98 |
//cerr << "MPDCli::updStatus" << endl;
|
104 |
//cerr << "MPDCli::updStatus" << endl;
|
99 |
if (!m_ok) {
|
105 |
if (!m_ok) {
|
100 |
cerr << "MPDCli::updStatus: bad state" << endl;
|
106 |
cerr << "MPDCli::updStatus: bad state" << endl;
|
101 |
return false;
|
107 |
return false;
|
102 |
}
|
108 |
}
|
103 |
memset(&m_stat, 0, sizeof(m_stat));
|
109 |
memset(&m_stat, 0, sizeof(m_stat));
|
104 |
mpd_status *mpds = mpd_run_status(M_CONN);
|
110 |
mpd_status *mpds = mpd_run_status(M_CONN);
|
105 |
if (mpds == 0) {
|
111 |
if (mpds == 0) {
|
106 |
cerr << "MPDCli::updStatus: status failed" << endl;
|
112 |
cerr << "MPDCli::updStatus: status failed. " <<
|
|
|
113 |
"connec error: " << mpd_connection_get_error_message(M_CONN) <<
|
|
|
114 |
"server error: " << mpd_connection_get_server_error(M_CONN) <<
|
|
|
115 |
endl;
|
107 |
return false;
|
116 |
return false;
|
108 |
}
|
117 |
}
|
109 |
m_stat.volume = mpd_status_get_volume(mpds);
|
118 |
m_stat.volume = mpd_status_get_volume(mpds);
|
110 |
m_stat.rept = mpd_status_get_repeat(mpds);
|
119 |
m_stat.rept = mpd_status_get_repeat(mpds);
|
111 |
m_stat.random = mpd_status_get_random(mpds);
|
120 |
m_stat.random = mpd_status_get_random(mpds);
|