Switch to unified view

a/src/ohplaylist.cxx b/src/ohplaylist.cxx
...
...
550
        ok = ok && sc.getString("Metadata", &metadata);
550
        ok = ok && sc.getString("Metadata", &metadata);
551
551
552
    LOGDEB("OHPlaylist::insert: afterid " << afterid << " Uri " <<
552
    LOGDEB("OHPlaylist::insert: afterid " << afterid << " Uri " <<
553
           uri << " Metadata " << metadata << endl);
553
           uri << " Metadata " << metadata << endl);
554
    if (ok) {
554
    if (ok) {
555
        UpSong metaformpd;
555
        int newid;
556
        if (!uMetaToUpSong(metadata, &metaformpd)) {
556
        ok = insertUri(afterid, uri, metadata, &newid);
557
            LOGERR("OHPlaylist::insert: failed to parse metadata " << " Uri " 
557
        if (ok) {
558
                   << uri << " Metadata " << metadata << endl);
558
            data.addarg("NewId", SoapHelp::i2s(newid));
559
            return UPNP_E_INTERNAL_ERROR;
559
            LOGDEB("OHPlaylist::insert: new id: " << newid << endl);
560
        }
560
        }
561
        int id = m_dev->m_mpdcli->insertAfterId(uri, afterid, metaformpd);
562
        if ((ok = (id != -1))) {
563
            m_metacache[uri] = metadata;
564
            m_cachedirty = true;
565
            m_mpdqvers = -1;
566
            data.addarg("NewId", SoapHelp::i2s(id));
567
            LOGDEB("OHPlaylist::insert: new id: " << id << endl);
568
        } else {
569
            LOGERR("OHPlaylist::insert: mpd error" << endl);
570
            return UPNP_E_INTERNAL_ERROR;
571
        }
572
    }
561
    }
573
    maybeWakeUp(ok);
562
    maybeWakeUp(ok);
574
    return ok ? UPNP_E_SUCCESS : UPNP_E_INTERNAL_ERROR;
563
    return ok ? UPNP_E_SUCCESS : UPNP_E_INTERNAL_ERROR;
564
}
565
566
bool OHPlaylist::insertUri(int afterid, const string& uri, 
567
                           const string& metadata, int *newid)
568
{
569
    UpSong metaformpd;
570
    if (!uMetaToUpSong(metadata, &metaformpd)) {
571
        LOGERR("OHPlaylist::insert: failed to parse metadata " << " Uri [" 
572
               << uri << "] Metadata [" << metadata << "]" << endl);
573
        return false;
574
    }
575
    int id = m_dev->m_mpdcli->insertAfterId(uri, afterid, metaformpd);
576
    if (id != -1) {
577
        m_metacache[uri] = metadata;
578
        m_cachedirty = true;
579
        m_mpdqvers = -1;
580
        if (newid)
581
            *newid = id;
582
        return true;
583
    } 
584
    LOGERR("OHPlaylist::insert: mpd error" << endl);
585
    return false;
575
}
586
}
576
587
577
int OHPlaylist::deleteId(const SoapArgs& sc, SoapData& data)
588
int OHPlaylist::deleteId(const SoapArgs& sc, SoapData& data)
578
{
589
{
579
    LOGDEB("OHPlaylist::deleteId" << endl);
590
    LOGDEB("OHPlaylist::deleteId" << endl);