|
a/src/ohradio.cxx |
|
b/src/ohradio.cxx |
|
... |
|
... |
56 |
};
|
56 |
};
|
57 |
|
57 |
|
58 |
static vector<RadioMeta> o_radios;
|
58 |
static vector<RadioMeta> o_radios;
|
59 |
|
59 |
|
60 |
OHRadio::OHRadio(UpMpd *dev)
|
60 |
OHRadio::OHRadio(UpMpd *dev)
|
61 |
: UpnpService(sTpProduct, sIdProduct, dev), m_dev(dev), m_active(false),
|
61 |
: OHService(sTpProduct, sIdProduct, dev), m_active(false),
|
62 |
m_id(0), m_songid(0), m_ok(false)
|
62 |
m_id(0), m_songid(0), m_ok(false)
|
63 |
{
|
63 |
{
|
64 |
// Need Python
|
64 |
// Need Python
|
65 |
string pypath;
|
65 |
string pypath;
|
66 |
if (!ExecCmd::which("python2", pypath)) {
|
66 |
if (!ExecCmd::which("python2", pypath)) {
|
|
... |
|
... |
192 |
st["TransportState"] = mpdstatusToTransportState(mpds.state);
|
192 |
st["TransportState"] = mpdstatusToTransportState(mpds.state);
|
193 |
st["Uri"] = mpds.currentsong.uri;
|
193 |
st["Uri"] = mpds.currentsong.uri;
|
194 |
return true;
|
194 |
return true;
|
195 |
}
|
195 |
}
|
196 |
|
196 |
|
197 |
bool OHRadio::getEventData(bool all, std::vector<std::string>& names,
|
|
|
198 |
std::vector<std::string>& values)
|
|
|
199 |
{
|
|
|
200 |
//LOGDEB("OHRadio::getEventData" << endl);
|
|
|
201 |
|
|
|
202 |
unordered_map<string, string> state;
|
|
|
203 |
|
|
|
204 |
makestate(state);
|
|
|
205 |
|
|
|
206 |
unordered_map<string, string> changed;
|
|
|
207 |
if (all) {
|
|
|
208 |
changed = state;
|
|
|
209 |
} else {
|
|
|
210 |
changed = diffmaps(m_state, state);
|
|
|
211 |
}
|
|
|
212 |
m_state = state;
|
|
|
213 |
|
|
|
214 |
for (auto it = changed.begin(); it != changed.end(); it++) {
|
|
|
215 |
names.push_back(it->first);
|
|
|
216 |
values.push_back(it->second);
|
|
|
217 |
}
|
|
|
218 |
|
|
|
219 |
return true;
|
|
|
220 |
}
|
|
|
221 |
|
|
|
222 |
void OHRadio::maybeWakeUp(bool ok)
|
197 |
void OHRadio::maybeWakeUp(bool ok)
|
223 |
{
|
198 |
{
|
224 |
if (ok && m_dev) {
|
199 |
if (ok && m_dev) {
|
225 |
m_dev->loopWakeup();
|
200 |
m_dev->loopWakeup();
|
226 |
}
|
201 |
}
|