Switch to unified view

a/src/ohplaylist.cxx b/src/ohplaylist.cxx
...
...
625
    bool ok = sc.get("AfterId", &afterid);
625
    bool ok = sc.get("AfterId", &afterid);
626
    ok = ok && sc.get("Uri", &uri);
626
    ok = ok && sc.get("Uri", &uri);
627
    if (ok)
627
    if (ok)
628
        ok = ok && sc.get("Metadata", &metadata);
628
        ok = ok && sc.get("Metadata", &metadata);
629
629
630
    if (!ok) {
631
        LOGERR("OHPlaylist::insert: no AfterId, Uri or Metadata parameter\n");
632
        return UPNP_E_INVALID_PARAM;
633
    }
634
630
    // Maybe transform a qobuz:// or tidal:// uri if we're doing this
635
    // Maybe transform a qobuz:// or tidal:// uri if we're doing this
636
    // isStreaming is used to disable content format check in this
637
    // case (there is no valid protocolinfo in general).
638
    bool isStreaming;
631
    OHCredsMaybeMorphSpecialUri(uri);
639
    if (!OHCredsMaybeMorphSpecialUri(uri, isStreaming)) {
632
640
        LOGERR("OHPlaylist::insert: bad uri: " << uri << endl);
641
        return UPNP_E_INVALID_PARAM;
642
    }
643
        
633
    if (!m_active) {
644
    if (!m_active) {
634
        // See comment in seekId()
645
        // See comment in seekId()
635
        // It's not clear if special-casing afterId == 0 is a good
646
        // It's not clear if special-casing afterId == 0 is a good
636
        // idea because it makes the device appear even more
647
        // idea because it makes the device appear even more
637
        // unpredictable. Otoh, it allows Bubble (basic, not DS) to
648
        // unpredictable. Otoh, it allows Bubble (basic, not DS) to
...
...
644
        }
655
        }
645
    }
656
    }
646
657
647
    LOGDEB("OHPlaylist::insert: afterid " << afterid << " Uri " <<
658
    LOGDEB("OHPlaylist::insert: afterid " << afterid << " Uri " <<
648
           uri << " Metadata " << metadata << endl);
659
           uri << " Metadata " << metadata << endl);
649
    if (ok) {
660
650
        int newid;
661
    int newid;
651
        ok = insertUri(afterid, uri, metadata, &newid);
662
    ok = insertUri(afterid, uri, metadata, &newid, isStreaming);
652
        if (ok) {
663
    if (ok) {
653
            data.addarg("NewId", SoapHelp::i2s(newid));
664
        data.addarg("NewId", SoapHelp::i2s(newid));
654
            LOGDEB("OHPlaylist::insert: new id: " << newid << endl);
665
        LOGDEB("OHPlaylist::insert: new id: " << newid << endl);
655
        }
656
    }
666
    }
657
    maybeWakeUp(ok);
667
    maybeWakeUp(ok);
658
    return ok ? UPNP_E_SUCCESS : UPNP_E_INTERNAL_ERROR;
668
    return ok ? UPNP_E_SUCCESS : UPNP_E_INTERNAL_ERROR;
659
}
669
}
660
670
661
bool OHPlaylist::insertUri(int afterid, const string& uri, 
671
bool OHPlaylist::insertUri(int afterid, const string& uri, 
662
                           const string& metadata, int *newid)
672
                           const string& metadata, int *newid, bool nocheck)
663
{
673
{
664
    LOGDEB1("OHPlaylist::insertUri: " << uri << endl);
674
    LOGDEB1("OHPlaylist::insertUri: " << uri << endl);
665
    if (!m_active) {
675
    if (!m_active) {
666
        LOGERR("OHPlaylist::insertUri: not active" << endl);
676
        LOGERR("OHPlaylist::insertUri: not active" << endl);
667
        return false;
677
        return false;
668
    }
678
    }
669
679
670
    UpSong metaformpd;
680
    UpSong metaformpd;
671
    if (!m_dev->checkContentFormat(uri, metadata, &metaformpd)) {
681
    if (!m_dev->checkContentFormat(uri, metadata, &metaformpd, nocheck)) {
672
        LOGERR("OHPlaylist::insertUri: unsupported format: uri " << uri <<
682
        LOGERR("OHPlaylist::insertUri: unsupported format: uri " << uri <<
673
               " metadata " << metadata);
683
               " metadata " << metadata);
674
        return false;
684
        return false;
675
    }
685
    }
676
    int id = m_dev->m_mpdcli->insertAfterId(uri, afterid, metaformpd);
686
    int id = m_dev->m_mpdcli->insertAfterId(uri, afterid, metaformpd);