Switch to unified view

a/src/ohplaylist.cxx b/src/ohplaylist.cxx
...
...
456
    }
456
    }
457
    if (ok) {
457
    if (ok) {
458
        auto cached = m_metacache.find(song.uri);
458
        auto cached = m_metacache.find(song.uri);
459
        string metadata;
459
        string metadata;
460
        if (cached != m_metacache.end()) {
460
        if (cached != m_metacache.end()) {
461
            metadata = SoapHelp::xmlQuote(cached->second);
461
            metadata = cached->second;
462
        } else {
462
        } else {
463
            metadata = didlmake(song);
463
            metadata = didlmake(song);
464
            m_metacache[song.uri] = metadata;
464
            m_metacache[song.uri] = metadata;
465
            m_cachedirty = true;
465
            m_cachedirty = true;
466
            metadata = SoapHelp::xmlQuote(metadata);
467
        }
466
        }
468
        data.addarg("Uri", song.uri);
467
        data.addarg("Uri", song.uri);
469
        data.addarg("Metadata", metadata);
468
        data.addarg("Metadata", metadata);
470
    }
469
    }
471
    return ok ? UPNP_E_SUCCESS : UPNP_E_INTERNAL_ERROR;
470
    return ok ? UPNP_E_SUCCESS : UPNP_E_INTERNAL_ERROR;
...
...
483
//  </TrackList>
482
//  </TrackList>
484
//
483
//
485
// Any ids not in the playlist are ignored. 
484
// Any ids not in the playlist are ignored. 
486
int OHPlaylist::readList(const SoapArgs& sc, SoapData& data)
485
int OHPlaylist::readList(const SoapArgs& sc, SoapData& data)
487
{
486
{
488
    LOGDEB("OHPlaylist::readList" << endl);
489
    string sids;
487
    string sids;
490
    bool ok = sc.getString("IdList", &sids);
488
    bool ok = sc.getString("IdList", &sids);
489
    LOGDEB("OHPlaylist::readList: [" << sids << "]" << endl);
491
    vector<string> ids;
490
    vector<string> ids;
492
    string out("<TrackList>");
491
    string out("<TrackList>");
493
    if (ok) {
492
    if (ok) {
494
        stringToTokens(sids, ids);
493
        stringToTokens(sids, ids);
495
        for (auto it = ids.begin(); it != ids.end(); it++) {
494
        for (auto it = ids.begin(); it != ids.end(); it++) {
...
...
498
                // Lumin does this??
497
                // Lumin does this??
499
                LOGDEB("OHPlaylist::readlist: request for id -1" << endl);
498
                LOGDEB("OHPlaylist::readlist: request for id -1" << endl);
500
                continue;
499
                continue;
501
            }
500
            }
502
            UpSong song;
501
            UpSong song;
503
            if (!m_dev->m_mpdcli->statSong(song, id, true))
502
            if (!m_dev->m_mpdcli->statSong(song, id, true)) {
503
                LOGDEB("OHPlaylist::readList:stat failed for " << id << endl);
504
                continue;
504
                continue;
505
            }
505
            auto mit = m_metacache.find(song.uri);
506
            auto mit = m_metacache.find(song.uri);
506
            string metadata;
507
            string metadata;
507
            if (mit != m_metacache.end()) {
508
            if (mit != m_metacache.end()) {
508
                //LOGDEB("readList: metadata for songid " << id << " uri " 
509
                //LOGDEB("OHPlaylist::readList: meta for id " << id << " uri "
509
                // << song.uri << " found in cache " << endl);
510
                // << song.uri << " found in cache " << endl);
510
                metadata = SoapHelp::xmlQuote(mit->second);
511
                metadata = SoapHelp::xmlQuote(mit->second);
511
            } else {
512
            } else {
512
                //LOGDEB("readList: metadata for songid " << id << " uri " 
513
                //LOGDEB("OHPlaylist::readList: meta for id " << id << " uri "
513
                // << song.uri << " not found " << endl);
514
                // << song.uri << " not found " << endl);
514
                metadata = didlmake(song);
515
                metadata = didlmake(song);
515
                m_metacache[song.uri] = metadata;
516
                m_metacache[song.uri] = metadata;
516
                m_cachedirty = true;
517
                m_cachedirty = true;
517
                metadata = SoapHelp::xmlQuote(metadata);
518
                metadata = SoapHelp::xmlQuote(metadata);
518
            }
519
            }
519
            out += "<Entry><Id>";
520
            out += "<Entry><Id>";
520
            out += it->c_str();
521
            out += SoapHelp::xmlQuote(it->c_str());
521
            out += "</Id><Uri>";
522
            out += "</Id><Uri>";
522
            out += song.uri;
523
            out += SoapHelp::xmlQuote(song.uri);
523
            out += "</Uri><Metadata>";
524
            out += "</Uri><Metadata>";
524
            out += metadata;
525
            out += metadata;
525
            out += "</Metadata></Entry>";
526
            out += "</Metadata></Entry>";
526
        }
527
        }
527
        out += "</TrackList>";
528
        out += "</TrackList>";
529
        //LOGDEB1("OHPlaylist::readList: out: [" << out << "]" << endl);
528
        data.addarg("TrackList", out);
530
        data.addarg("TrackList", out);
529
    }
531
    }
530
    return ok ? UPNP_E_SUCCESS : UPNP_E_INTERNAL_ERROR;
532
    return ok ? UPNP_E_SUCCESS : UPNP_E_INTERNAL_ERROR;
531
}
533
}
532
534