|
a/src/ohplaylist.cxx |
|
b/src/ohplaylist.cxx |
|
... |
|
... |
320 |
|
320 |
|
321 |
int OHPlaylist::setRepeat(const SoapIncoming& sc, SoapOutgoing& data)
|
321 |
int OHPlaylist::setRepeat(const SoapIncoming& sc, SoapOutgoing& data)
|
322 |
{
|
322 |
{
|
323 |
LOGDEB("OHPlaylist::setRepeat" << endl);
|
323 |
LOGDEB("OHPlaylist::setRepeat" << endl);
|
324 |
bool onoff;
|
324 |
bool onoff;
|
325 |
bool ok = sc.getBool("Value", &onoff);
|
325 |
bool ok = sc.get("Value", &onoff);
|
326 |
if (ok) {
|
326 |
if (ok) {
|
327 |
ok = m_dev->m_mpdcli->repeat(onoff);
|
327 |
ok = m_dev->m_mpdcli->repeat(onoff);
|
328 |
maybeWakeUp(ok);
|
328 |
maybeWakeUp(ok);
|
329 |
}
|
329 |
}
|
330 |
return ok ? UPNP_E_SUCCESS : UPNP_E_INTERNAL_ERROR;
|
330 |
return ok ? UPNP_E_SUCCESS : UPNP_E_INTERNAL_ERROR;
|
|
... |
|
... |
340 |
|
340 |
|
341 |
int OHPlaylist::setShuffle(const SoapIncoming& sc, SoapOutgoing& data)
|
341 |
int OHPlaylist::setShuffle(const SoapIncoming& sc, SoapOutgoing& data)
|
342 |
{
|
342 |
{
|
343 |
LOGDEB("OHPlaylist::setShuffle" << endl);
|
343 |
LOGDEB("OHPlaylist::setShuffle" << endl);
|
344 |
bool onoff;
|
344 |
bool onoff;
|
345 |
bool ok = sc.getBool("Value", &onoff);
|
345 |
bool ok = sc.get("Value", &onoff);
|
346 |
if (ok) {
|
346 |
if (ok) {
|
347 |
// Note that mpd shuffle shuffles the playlist, which is different
|
347 |
// Note that mpd shuffle shuffles the playlist, which is different
|
348 |
// from playing at random
|
348 |
// from playing at random
|
349 |
ok = m_dev->m_mpdcli->random(onoff);
|
349 |
ok = m_dev->m_mpdcli->random(onoff);
|
350 |
maybeWakeUp(ok);
|
350 |
maybeWakeUp(ok);
|
|
... |
|
... |
362 |
|
362 |
|
363 |
int OHPlaylist::seekSecondAbsolute(const SoapIncoming& sc, SoapOutgoing& data)
|
363 |
int OHPlaylist::seekSecondAbsolute(const SoapIncoming& sc, SoapOutgoing& data)
|
364 |
{
|
364 |
{
|
365 |
LOGDEB("OHPlaylist::seekSecondAbsolute" << endl);
|
365 |
LOGDEB("OHPlaylist::seekSecondAbsolute" << endl);
|
366 |
int seconds;
|
366 |
int seconds;
|
367 |
bool ok = sc.getInt("Value", &seconds);
|
367 |
bool ok = sc.get("Value", &seconds);
|
368 |
if (ok) {
|
368 |
if (ok) {
|
369 |
ok = m_dev->m_mpdcli->seek(seconds);
|
369 |
ok = m_dev->m_mpdcli->seek(seconds);
|
370 |
maybeWakeUp(ok);
|
370 |
maybeWakeUp(ok);
|
371 |
}
|
371 |
}
|
372 |
return ok ? UPNP_E_SUCCESS : UPNP_E_INTERNAL_ERROR;
|
372 |
return ok ? UPNP_E_SUCCESS : UPNP_E_INTERNAL_ERROR;
|
|
... |
|
... |
374 |
|
374 |
|
375 |
int OHPlaylist::seekSecondRelative(const SoapIncoming& sc, SoapOutgoing& data)
|
375 |
int OHPlaylist::seekSecondRelative(const SoapIncoming& sc, SoapOutgoing& data)
|
376 |
{
|
376 |
{
|
377 |
LOGDEB("OHPlaylist::seekSecondRelative" << endl);
|
377 |
LOGDEB("OHPlaylist::seekSecondRelative" << endl);
|
378 |
int seconds;
|
378 |
int seconds;
|
379 |
bool ok = sc.getInt("Value", &seconds);
|
379 |
bool ok = sc.get("Value", &seconds);
|
380 |
if (ok) {
|
380 |
if (ok) {
|
381 |
const MpdStatus &mpds = m_dev->getMpdStatusNoUpdate();
|
381 |
const MpdStatus &mpds = m_dev->getMpdStatusNoUpdate();
|
382 |
bool is_song = (mpds.state == MpdStatus::MPDS_PLAY) ||
|
382 |
bool is_song = (mpds.state == MpdStatus::MPDS_PLAY) ||
|
383 |
(mpds.state == MpdStatus::MPDS_PAUSE);
|
383 |
(mpds.state == MpdStatus::MPDS_PAUSE);
|
384 |
if (is_song) {
|
384 |
if (is_song) {
|
|
... |
|
... |
414 |
// Skip to track specified by Id
|
414 |
// Skip to track specified by Id
|
415 |
int OHPlaylist::seekId(const SoapIncoming& sc, SoapOutgoing& data)
|
415 |
int OHPlaylist::seekId(const SoapIncoming& sc, SoapOutgoing& data)
|
416 |
{
|
416 |
{
|
417 |
LOGDEB("OHPlaylist::seekId" << endl);
|
417 |
LOGDEB("OHPlaylist::seekId" << endl);
|
418 |
int id;
|
418 |
int id;
|
419 |
bool ok = sc.getInt("Value", &id);
|
419 |
bool ok = sc.get("Value", &id);
|
420 |
if (ok) {
|
420 |
if (ok) {
|
421 |
ok = m_dev->m_mpdcli->playId(id);
|
421 |
ok = m_dev->m_mpdcli->playId(id);
|
422 |
maybeWakeUp(ok);
|
422 |
maybeWakeUp(ok);
|
423 |
}
|
423 |
}
|
424 |
return ok ? UPNP_E_SUCCESS : UPNP_E_INTERNAL_ERROR;
|
424 |
return ok ? UPNP_E_SUCCESS : UPNP_E_INTERNAL_ERROR;
|
|
... |
|
... |
427 |
// Skip to track with specified index
|
427 |
// Skip to track with specified index
|
428 |
int OHPlaylist::seekIndex(const SoapIncoming& sc, SoapOutgoing& data)
|
428 |
int OHPlaylist::seekIndex(const SoapIncoming& sc, SoapOutgoing& data)
|
429 |
{
|
429 |
{
|
430 |
LOGDEB("OHPlaylist::seekIndex" << endl);
|
430 |
LOGDEB("OHPlaylist::seekIndex" << endl);
|
431 |
int pos;
|
431 |
int pos;
|
432 |
bool ok = sc.getInt("Value", &pos);
|
432 |
bool ok = sc.get("Value", &pos);
|
433 |
if (ok) {
|
433 |
if (ok) {
|
434 |
ok = m_dev->m_mpdcli->play(pos);
|
434 |
ok = m_dev->m_mpdcli->play(pos);
|
435 |
maybeWakeUp(ok);
|
435 |
maybeWakeUp(ok);
|
436 |
}
|
436 |
}
|
437 |
return ok ? UPNP_E_SUCCESS : UPNP_E_INTERNAL_ERROR;
|
437 |
return ok ? UPNP_E_SUCCESS : UPNP_E_INTERNAL_ERROR;
|
|
... |
|
... |
459 |
// Report the uri and metadata for a given track id.
|
459 |
// Report the uri and metadata for a given track id.
|
460 |
// Returns a 800 fault code if the given id is not in the playlist.
|
460 |
// Returns a 800 fault code if the given id is not in the playlist.
|
461 |
int OHPlaylist::ohread(const SoapIncoming& sc, SoapOutgoing& data)
|
461 |
int OHPlaylist::ohread(const SoapIncoming& sc, SoapOutgoing& data)
|
462 |
{
|
462 |
{
|
463 |
int id;
|
463 |
int id;
|
464 |
bool ok = sc.getInt("Id", &id);
|
464 |
bool ok = sc.get("Id", &id);
|
465 |
LOGDEB("OHPlaylist::ohread id " << id << endl);
|
465 |
LOGDEB("OHPlaylist::ohread id " << id << endl);
|
466 |
UpSong song;
|
466 |
UpSong song;
|
467 |
if (ok) {
|
467 |
if (ok) {
|
468 |
ok = m_dev->m_mpdcli->statSong(song, id, true);
|
468 |
ok = m_dev->m_mpdcli->statSong(song, id, true);
|
469 |
}
|
469 |
}
|
|
... |
|
... |
496 |
//
|
496 |
//
|
497 |
// Any ids not in the playlist are ignored.
|
497 |
// Any ids not in the playlist are ignored.
|
498 |
int OHPlaylist::readList(const SoapIncoming& sc, SoapOutgoing& data)
|
498 |
int OHPlaylist::readList(const SoapIncoming& sc, SoapOutgoing& data)
|
499 |
{
|
499 |
{
|
500 |
string sids;
|
500 |
string sids;
|
501 |
bool ok = sc.getString("IdList", &sids);
|
501 |
bool ok = sc.get("IdList", &sids);
|
502 |
LOGDEB("OHPlaylist::readList: [" << sids << "]" << endl);
|
502 |
LOGDEB("OHPlaylist::readList: [" << sids << "]" << endl);
|
503 |
vector<string> ids;
|
503 |
vector<string> ids;
|
504 |
string out("<TrackList>");
|
504 |
string out("<TrackList>");
|
505 |
if (ok) {
|
505 |
if (ok) {
|
506 |
stringToTokens(sids, ids);
|
506 |
stringToTokens(sids, ids);
|
|
... |
|
... |
568 |
int OHPlaylist::insert(const SoapIncoming& sc, SoapOutgoing& data)
|
568 |
int OHPlaylist::insert(const SoapIncoming& sc, SoapOutgoing& data)
|
569 |
{
|
569 |
{
|
570 |
LOGDEB("OHPlaylist::insert" << endl);
|
570 |
LOGDEB("OHPlaylist::insert" << endl);
|
571 |
int afterid;
|
571 |
int afterid;
|
572 |
string uri, metadata;
|
572 |
string uri, metadata;
|
573 |
bool ok = sc.getInt("AfterId", &afterid);
|
573 |
bool ok = sc.get("AfterId", &afterid);
|
574 |
ok = ok && sc.getString("Uri", &uri);
|
574 |
ok = ok && sc.get("Uri", &uri);
|
575 |
if (ok)
|
575 |
if (ok)
|
576 |
ok = ok && sc.getString("Metadata", &metadata);
|
576 |
ok = ok && sc.get("Metadata", &metadata);
|
577 |
|
577 |
|
578 |
LOGDEB("OHPlaylist::insert: afterid " << afterid << " Uri " <<
|
578 |
LOGDEB("OHPlaylist::insert: afterid " << afterid << " Uri " <<
|
579 |
uri << " Metadata " << metadata << endl);
|
579 |
uri << " Metadata " << metadata << endl);
|
580 |
if (ok) {
|
580 |
if (ok) {
|
581 |
int newid;
|
581 |
int newid;
|
|
... |
|
... |
613 |
|
613 |
|
614 |
int OHPlaylist::deleteId(const SoapIncoming& sc, SoapOutgoing& data)
|
614 |
int OHPlaylist::deleteId(const SoapIncoming& sc, SoapOutgoing& data)
|
615 |
{
|
615 |
{
|
616 |
LOGDEB("OHPlaylist::deleteId" << endl);
|
616 |
LOGDEB("OHPlaylist::deleteId" << endl);
|
617 |
int id;
|
617 |
int id;
|
618 |
bool ok = sc.getInt("Value", &id);
|
618 |
bool ok = sc.get("Value", &id);
|
619 |
if (ok) {
|
619 |
if (ok) {
|
620 |
const MpdStatus &mpds = m_dev->getMpdStatusNoUpdate();
|
620 |
const MpdStatus &mpds = m_dev->getMpdStatusNoUpdate();
|
621 |
if (mpds.songid == id) {
|
621 |
if (mpds.songid == id) {
|
622 |
// MPD skips to the next track if the current one is removed,
|
622 |
// MPD skips to the next track if the current one is removed,
|
623 |
// but I think it's better to stop in this case
|
623 |
// but I think it's better to stop in this case
|
|
... |
|
... |
695 |
// Check if id array changed since last call (which returned a gen token)
|
695 |
// Check if id array changed since last call (which returned a gen token)
|
696 |
int OHPlaylist::idArrayChanged(const SoapIncoming& sc, SoapOutgoing& data)
|
696 |
int OHPlaylist::idArrayChanged(const SoapIncoming& sc, SoapOutgoing& data)
|
697 |
{
|
697 |
{
|
698 |
LOGDEB("OHPlaylist::idArrayChanged" << endl);
|
698 |
LOGDEB("OHPlaylist::idArrayChanged" << endl);
|
699 |
int qvers;
|
699 |
int qvers;
|
700 |
bool ok = sc.getInt("Token", &qvers);
|
700 |
bool ok = sc.get("Token", &qvers);
|
701 |
const MpdStatus &mpds = m_dev->getMpdStatusNoUpdate();
|
701 |
const MpdStatus &mpds = m_dev->getMpdStatusNoUpdate();
|
702 |
|
702 |
|
703 |
LOGDEB("OHPlaylist::idArrayChanged: query qvers " << qvers <<
|
703 |
LOGDEB("OHPlaylist::idArrayChanged: query qvers " << qvers <<
|
704 |
" mpd qvers " << mpds.qvers << endl);
|
704 |
" mpd qvers " << mpds.qvers << endl);
|
705 |
|
705 |
|