|
a/upmpd/ohtime.cxx |
|
b/upmpd/ohtime.cxx |
|
... |
|
... |
52 |
void OHTime::getdata(string& trackcount, string &duration,
|
52 |
void OHTime::getdata(string& trackcount, string &duration,
|
53 |
string& seconds)
|
53 |
string& seconds)
|
54 |
{
|
54 |
{
|
55 |
const MpdStatus &mpds = m_dev->getMpdStatus();
|
55 |
const MpdStatus &mpds = m_dev->getMpdStatus();
|
56 |
|
56 |
|
57 |
char cbuf[30];
|
57 |
trackcount = SoapArgs::i2s(mpds.trackcounter);
|
58 |
sprintf(cbuf, "%d", mpds.trackcounter);
|
58 |
|
59 |
trackcount = cbuf;
|
|
|
60 |
bool is_song = (mpds.state == MpdStatus::MPDS_PLAY) ||
|
59 |
bool is_song = (mpds.state == MpdStatus::MPDS_PLAY) ||
|
61 |
(mpds.state == MpdStatus::MPDS_PAUSE);
|
60 |
(mpds.state == MpdStatus::MPDS_PAUSE);
|
62 |
if (is_song) {
|
61 |
if (is_song) {
|
63 |
sprintf(cbuf, "%u", mpds.songlenms / 1000);
|
62 |
duration = SoapArgs::i2s(mpds.songlenms / 1000);
|
64 |
duration = cbuf;
|
63 |
seconds = SoapArgs::i2s(mpds.songelapsedms / 1000);
|
65 |
sprintf(cbuf, "%u", mpds.songelapsedms / 1000);
|
|
|
66 |
seconds = cbuf;
|
|
|
67 |
} else {
|
64 |
} else {
|
68 |
duration = "0";
|
65 |
duration = "0";
|
69 |
seconds = "0";
|
66 |
seconds = "0";
|
70 |
}
|
67 |
}
|
71 |
}
|
68 |
}
|