|
a/src/ohradio.cxx |
|
b/src/ohradio.cxx |
|
... |
|
... |
212 |
if (ok && m_dev) {
|
212 |
if (ok && m_dev) {
|
213 |
m_dev->loopWakeup();
|
213 |
m_dev->loopWakeup();
|
214 |
}
|
214 |
}
|
215 |
}
|
215 |
}
|
216 |
|
216 |
|
217 |
int OHRadio::setPlaying(const string& uri)
|
217 |
int OHRadio::setPlaying()
|
218 |
{
|
218 |
{
|
219 |
string cmdpath = path_cat(g_datadir, "rdpl2stream");
|
219 |
string cmdpath = path_cat(g_datadir, "rdpl2stream");
|
220 |
cmdpath = path_cat(cmdpath, "fetchStream.py");
|
220 |
cmdpath = path_cat(cmdpath, "fetchStream.py");
|
221 |
|
221 |
|
222 |
// Execute the playlist parser
|
222 |
// Execute the playlist parser
|
223 |
ExecCmd cmd;
|
223 |
ExecCmd cmd;
|
224 |
vector<string> args;
|
224 |
vector<string> args;
|
225 |
args.push_back(uri);
|
225 |
args.push_back(o_radios[m_id].uri);
|
226 |
LOGDEB("OHRadio::setPlaying: exec: " << cmdpath << " " << args[0] << endl);
|
226 |
LOGDEB("OHRadio::setPlaying: exec: " << cmdpath << " " << args[0] << endl);
|
227 |
if (cmd.startExec(cmdpath, args, false, true) < 0) {
|
227 |
if (cmd.startExec(cmdpath, args, false, true) < 0) {
|
228 |
LOGDEB("OHRadio::setPlaying: startExec failed for " <<
|
228 |
LOGDEB("OHRadio::setPlaying: startExec failed for " <<
|
229 |
cmdpath << " " << args[0] << endl);
|
229 |
cmdpath << " " << args[0] << endl);
|
230 |
return UPNP_E_INTERNAL_ERROR;
|
230 |
return UPNP_E_INTERNAL_ERROR;
|
|
... |
|
... |
262 |
}
|
262 |
}
|
263 |
return UPNP_E_SUCCESS;
|
263 |
return UPNP_E_SUCCESS;
|
264 |
}
|
264 |
}
|
265 |
|
265 |
|
266 |
void OHRadio::setActive(bool onoff) {
|
266 |
void OHRadio::setActive(bool onoff) {
|
|
|
267 |
if (onoff) {
|
|
|
268 |
m_dev->m_mpdcli->saveState(m_mpdsavedstate, 0);
|
|
|
269 |
m_dev->m_mpdcli->clearQueue();
|
|
|
270 |
} else {
|
|
|
271 |
m_dev->m_mpdcli->clearQueue();
|
|
|
272 |
m_dev->m_mpdcli->restoreState(m_mpdsavedstate);
|
|
|
273 |
}
|
267 |
m_active = onoff;
|
274 |
m_active = onoff;
|
268 |
if (!onoff) {
|
|
|
269 |
if (m_songid > 0)
|
|
|
270 |
m_dev->m_mpdcli->deleteId(m_songid);
|
|
|
271 |
m_dev->m_mpdcli->single(false);
|
|
|
272 |
}
|
|
|
273 |
}
|
275 |
}
|
274 |
|
276 |
|
275 |
int OHRadio::play(const SoapIncoming& sc, SoapOutgoing& data)
|
277 |
int OHRadio::play(const SoapIncoming& sc, SoapOutgoing& data)
|
276 |
{
|
278 |
{
|
277 |
LOGDEB("OHRadio::play" << endl);
|
279 |
LOGDEB("OHRadio::play" << endl);
|
278 |
if (!m_active && m_dev->m_ohpr) {
|
280 |
if (!m_active && m_dev->m_ohpr) {
|
279 |
m_dev->m_ohpr->iSetSourceIndexByName("Radio");
|
281 |
m_dev->m_ohpr->iSetSourceIndexByName("Radio");
|
280 |
}
|
282 |
}
|
281 |
int ret = setPlaying(o_radios[m_id].uri);
|
283 |
int ret = setPlaying();
|
282 |
maybeWakeUp(ret == UPNP_E_SUCCESS);
|
284 |
maybeWakeUp(ret == UPNP_E_SUCCESS);
|
283 |
return ret;
|
285 |
return ret;
|
284 |
}
|
286 |
}
|
285 |
|
287 |
|
286 |
int OHRadio::pause(const SoapIncoming& sc, SoapOutgoing& data)
|
288 |
int OHRadio::pause(const SoapIncoming& sc, SoapOutgoing& data)
|