|
a/src/ohradio.cxx |
|
b/src/ohradio.cxx |
|
... |
|
... |
337 |
LOGDEB("OHRadio::id" << endl);
|
337 |
LOGDEB("OHRadio::id" << endl);
|
338 |
data.addarg("Value", SoapHelp::i2s(m_id));
|
338 |
data.addarg("Value", SoapHelp::i2s(m_id));
|
339 |
return UPNP_E_SUCCESS;
|
339 |
return UPNP_E_SUCCESS;
|
340 |
}
|
340 |
}
|
341 |
|
341 |
|
|
|
342 |
static string radioDidlMake(const string& uri, const string& title,
|
|
|
343 |
const string& artUri)
|
|
|
344 |
{
|
|
|
345 |
string out("<DIDL-Lite xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n"
|
|
|
346 |
"xmlns:upnp=\"urn:schemas-upnp-org:metadata-1-0/upnp/\"\n"
|
|
|
347 |
"xmlns=\"urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/\">\n"
|
|
|
348 |
"<item id=\"\" parentID=\"\" restricted=\"True\">\n"
|
|
|
349 |
"<dc:title>");
|
|
|
350 |
out += SoapHelp::xmlQuote(title);
|
|
|
351 |
out += "</dc:title>\n"
|
|
|
352 |
"<res protocolInfo=\"*:*:*:*\" bitrate=\"6000\">";
|
|
|
353 |
out += SoapHelp::xmlQuote(uri);
|
|
|
354 |
out += "</res>\n"
|
|
|
355 |
"<upnp:albumArtURI>";
|
|
|
356 |
out += SoapHelp::xmlQuote(artUri);
|
|
|
357 |
out += "</upnp:albumArtURI>\n"
|
|
|
358 |
"<upnp:class>object.item.audioItem</upnp:class>\n"
|
|
|
359 |
"</item>\n"
|
|
|
360 |
"</DIDL-Lite>\n";
|
|
|
361 |
return out;
|
|
|
362 |
}
|
|
|
363 |
|
342 |
string OHRadio::metaForId(unsigned int id)
|
364 |
string OHRadio::metaForId(unsigned int id)
|
343 |
{
|
365 |
{
|
344 |
string meta;
|
366 |
string meta;
|
345 |
if (id >= 0 && id < o_radios.size()) {
|
367 |
if (id >= 0 && id < o_radios.size()) {
|
346 |
if (id == m_id) {
|
368 |
if (0 && id == m_id) {
|
347 |
meta = m_state["Metadata"];
|
369 |
meta = m_state["Metadata"];
|
348 |
} else {
|
370 |
} else {
|
349 |
UpSong song;
|
371 |
meta = radioDidlMake(o_radios[id].uri, o_radios[id].title, "");
|
350 |
song.title = o_radios[id].title;
|
|
|
351 |
song.uri = o_radios[id].uri;
|
|
|
352 |
meta = didlmake(song);
|
|
|
353 |
}
|
372 |
}
|
354 |
}
|
373 |
}
|
355 |
return meta;
|
374 |
return meta;
|
356 |
}
|
375 |
}
|
357 |
|
376 |
|
358 |
// Report the uri and metadata for a given channel id.
|
377 |
// Report the uri and metadata for a given channel id.
|
359 |
int OHRadio::ohread(const SoapIncoming& sc, SoapOutgoing& data)
|
378 |
int OHRadio::ohread(const SoapIncoming& sc, SoapOutgoing& data)
|
360 |
{
|
379 |
{
|
361 |
int id;
|
380 |
int id;
|
362 |
bool ok = sc.get("Id", &id);
|
381 |
bool ok = sc.get("Id", &id);
|
363 |
LOGDEB("OHRadio::read id " << id << endl);
|
|
|
364 |
if (ok) {
|
382 |
if (ok) {
|
|
|
383 |
LOGDEB("OHRadio::read id " << id << endl);
|
365 |
if (id >= 0 && id < int(o_radios.size())) {
|
384 |
if (id >= 0 && id < int(o_radios.size())) {
|
366 |
data.addarg("Uri", o_radios[id].uri);
|
|
|
367 |
string meta = metaForId(id);
|
385 |
string meta = metaForId(id);
|
368 |
data.addarg("Metadata", meta);
|
386 |
data.addarg("Metadata", meta);
|
369 |
} else {
|
387 |
} else {
|
370 |
ok = false;
|
388 |
ok = false;
|
371 |
}
|
389 |
}
|
|
... |
|
... |
377 |
// uri and metadata in the following xml form:
|
395 |
// uri and metadata in the following xml form:
|
378 |
//
|
396 |
//
|
379 |
// <TrackList>
|
397 |
// <TrackList>
|
380 |
// <Entry>
|
398 |
// <Entry>
|
381 |
// <Id></Id>
|
399 |
// <Id></Id>
|
382 |
// <Uri></Uri>
|
|
|
383 |
// <Metadata></Metadata>
|
400 |
// <Metadata></Metadata>
|
384 |
// </Entry>
|
401 |
// </Entry>
|
385 |
// </TrackList>
|
402 |
// </TrackList>
|
386 |
//
|
403 |
//
|
387 |
// Any ids not in the radio are ignored.
|
404 |
// Any ids not in the radio are ignored.
|