Switch to unified view

a/upmpd/ohplaylist.cxx b/upmpd/ohplaylist.cxx
...
...
138
            out1 += (unsigned char) ((val & 0xff000000) >> 24);
138
            out1 += (unsigned char) ((val & 0xff000000) >> 24);
139
            out1 += (unsigned char) ((val & 0x00ff0000) >> 16);
139
            out1 += (unsigned char) ((val & 0x00ff0000) >> 16);
140
            out1 += (unsigned char) ((val & 0x0000ff00) >> 8);
140
            out1 += (unsigned char) ((val & 0x0000ff00) >> 8);
141
            out1 += (unsigned char) ((val & 0x000000ff));
141
            out1 += (unsigned char) ((val & 0x000000ff));
142
        }
142
        }
143
        sdeb += SoapArgs::i2s(val) + " ";
143
        sdeb += SoapHelp::i2s(val) + " ";
144
    }
144
    }
145
    LOGDEB("OHPlaylist: current ids: " << sdeb << endl);
145
    LOGDEB("OHPlaylist: current ids: " << sdeb << endl);
146
    return base64_encode(out1);
146
    return base64_encode(out1);
147
}
147
}
148
148
...
...
225
    st.clear();
225
    st.clear();
226
226
227
    const MpdStatus &mpds = m_dev->getMpdStatusNoUpdate();
227
    const MpdStatus &mpds = m_dev->getMpdStatusNoUpdate();
228
228
229
    st["TransportState"] =  mpdstatusToTransportState(mpds.state);
229
    st["TransportState"] =  mpdstatusToTransportState(mpds.state);
230
    st["Repeat"] = SoapArgs::i2s(mpds.rept);
230
    st["Repeat"] = SoapHelp::i2s(mpds.rept);
231
    st["Shuffle"] = SoapArgs::i2s(mpds.random);
231
    st["Shuffle"] = SoapHelp::i2s(mpds.random);
232
    st["Id"] = SoapArgs::i2s(mpds.songid);
232
    st["Id"] = SoapHelp::i2s(mpds.songid);
233
    st["TracksMax"] = SoapArgs::i2s(tracksmax);
233
    st["TracksMax"] = SoapHelp::i2s(tracksmax);
234
    st["ProtocolInfo"] = upmpdProtocolInfo;
234
    st["ProtocolInfo"] = upmpdProtocolInfo;
235
    makeIdArray(st["IdArray"]);
235
    makeIdArray(st["IdArray"]);
236
236
237
    return true;
237
    return true;
238
}
238
}
...
...
430
// Return current Id
430
// Return current Id
431
int OHPlaylist::id(const SoapArgs& sc, SoapData& data)
431
int OHPlaylist::id(const SoapArgs& sc, SoapData& data)
432
{
432
{
433
    LOGDEB("OHPlaylist::id" << endl);
433
    LOGDEB("OHPlaylist::id" << endl);
434
    const MpdStatus &mpds = m_dev->getMpdStatusNoUpdate();
434
    const MpdStatus &mpds = m_dev->getMpdStatusNoUpdate();
435
    data.addarg("Value", SoapArgs::i2s(mpds.songid));
435
    data.addarg("Value", SoapHelp::i2s(mpds.songid));
436
    return UPNP_E_SUCCESS;
436
    return UPNP_E_SUCCESS;
437
}
437
}
438
438
439
// Report the uri and metadata for a given track id. 
439
// Report the uri and metadata for a given track id. 
440
// Returns a 800 fault code if the given id is not in the playlist. 
440
// Returns a 800 fault code if the given id is not in the playlist. 
...
...
449
    }
449
    }
450
    if (ok) {
450
    if (ok) {
451
        auto cached = m_metacache.find(song.uri);
451
        auto cached = m_metacache.find(song.uri);
452
        string metadata;
452
        string metadata;
453
        if (cached != m_metacache.end()) {
453
        if (cached != m_metacache.end()) {
454
            metadata = SoapArgs::xmlQuote(cached->second);
454
            metadata = SoapHelp::xmlQuote(cached->second);
455
        } else {
455
        } else {
456
            metadata = didlmake(song);
456
            metadata = didlmake(song);
457
            m_metacache[song.uri] = metadata;
457
            m_metacache[song.uri] = metadata;
458
            m_cachedirty = true;
458
            m_cachedirty = true;
459
            metadata = SoapArgs::xmlQuote(metadata);
459
            metadata = SoapHelp::xmlQuote(metadata);
460
        }
460
        }
461
        data.addarg("Uri", song.uri);
461
        data.addarg("Uri", song.uri);
462
        data.addarg("Metadata", metadata);
462
        data.addarg("Metadata", metadata);
463
    }
463
    }
464
    return ok ? UPNP_E_SUCCESS : UPNP_E_INTERNAL_ERROR;
464
    return ok ? UPNP_E_SUCCESS : UPNP_E_INTERNAL_ERROR;
...
...
498
            auto mit = m_metacache.find(song.uri);
498
            auto mit = m_metacache.find(song.uri);
499
            string metadata;
499
            string metadata;
500
            if (mit != m_metacache.end()) {
500
            if (mit != m_metacache.end()) {
501
                //LOGDEB("readList: metadata for songid " << id << " uri " 
501
                //LOGDEB("readList: metadata for songid " << id << " uri " 
502
                // << song.uri << " found in cache " << endl);
502
                // << song.uri << " found in cache " << endl);
503
                metadata = SoapArgs::xmlQuote(mit->second);
503
                metadata = SoapHelp::xmlQuote(mit->second);
504
            } else {
504
            } else {
505
                //LOGDEB("readList: metadata for songid " << id << " uri " 
505
                //LOGDEB("readList: metadata for songid " << id << " uri " 
506
                // << song.uri << " not found " << endl);
506
                // << song.uri << " not found " << endl);
507
                metadata = didlmake(song);
507
                metadata = didlmake(song);
508
                m_metacache[song.uri] = metadata;
508
                m_metacache[song.uri] = metadata;
509
                m_cachedirty = true;
509
                m_cachedirty = true;
510
                metadata = SoapArgs::xmlQuote(metadata);
510
                metadata = SoapHelp::xmlQuote(metadata);
511
            }
511
            }
512
            out += "<Entry><Id>";
512
            out += "<Entry><Id>";
513
            out += sid.c_str();
513
            out += sid.c_str();
514
            out += "</Id><Uri>";
514
            out += "</Id><Uri>";
515
            out += song.uri;
515
            out += song.uri;
...
...
546
        int id = m_dev->m_mpdcli->insertAfterId(uri, afterid);
546
        int id = m_dev->m_mpdcli->insertAfterId(uri, afterid);
547
        if ((ok = (id != -1))) {
547
        if ((ok = (id != -1))) {
548
            m_metacache[uri] = metadata;
548
            m_metacache[uri] = metadata;
549
            m_cachedirty = true;
549
            m_cachedirty = true;
550
            m_mpdqvers = -1;
550
            m_mpdqvers = -1;
551
            data.addarg("NewId", SoapArgs::i2s(id));
551
            data.addarg("NewId", SoapHelp::i2s(id));
552
        }
552
        }
553
        LOGDEB("OHPlaylist::insert: new id: " << id << endl);
553
        LOGDEB("OHPlaylist::insert: new id: " << id << endl);
554
    }
554
    }
555
    maybeWakeUp(ok);
555
    maybeWakeUp(ok);
556
    return ok ? UPNP_E_SUCCESS : UPNP_E_INTERNAL_ERROR;
556
    return ok ? UPNP_E_SUCCESS : UPNP_E_INTERNAL_ERROR;
...
...
579
}
579
}
580
580
581
int OHPlaylist::tracksMax(const SoapArgs& sc, SoapData& data)
581
int OHPlaylist::tracksMax(const SoapArgs& sc, SoapData& data)
582
{
582
{
583
    LOGDEB("OHPlaylist::tracksMax" << endl);
583
    LOGDEB("OHPlaylist::tracksMax" << endl);
584
    data.addarg("Value", SoapArgs::i2s(tracksmax));
584
    data.addarg("Value", SoapHelp::i2s(tracksmax));
585
    return UPNP_E_SUCCESS;
585
    return UPNP_E_SUCCESS;
586
}
586
}
587
587
588
// Returns current list of id as array of big endian 32bits integers,
588
// Returns current list of id as array of big endian 32bits integers,
589
// base-64-encoded. 
589
// base-64-encoded. 
...
...
592
    LOGDEB("OHPlaylist::idArray" << endl);
592
    LOGDEB("OHPlaylist::idArray" << endl);
593
    string idarray;
593
    string idarray;
594
    if (makeIdArray(idarray)) {
594
    if (makeIdArray(idarray)) {
595
        const MpdStatus &mpds = m_dev->getMpdStatusNoUpdate();
595
        const MpdStatus &mpds = m_dev->getMpdStatusNoUpdate();
596
        LOGDEB("OHPlaylist::idArray: qvers " << mpds.qvers << endl);
596
        LOGDEB("OHPlaylist::idArray: qvers " << mpds.qvers << endl);
597
        data.addarg("Token", SoapArgs::i2s(mpds.qvers));
597
        data.addarg("Token", SoapHelp::i2s(mpds.qvers));
598
        data.addarg("Array", idarray);
598
        data.addarg("Array", idarray);
599
        return UPNP_E_SUCCESS;
599
        return UPNP_E_SUCCESS;
600
    }
600
    }
601
    return UPNP_E_INTERNAL_ERROR;
601
    return UPNP_E_INTERNAL_ERROR;
602
}
602
}
...
...
612
    LOGDEB("OHPlaylist::idArrayChanged: query qvers " << qvers << 
612
    LOGDEB("OHPlaylist::idArrayChanged: query qvers " << qvers << 
613
           " mpd qvers " << mpds.qvers << endl);
613
           " mpd qvers " << mpds.qvers << endl);
614
614
615
    // Bool indicating if array changed
615
    // Bool indicating if array changed
616
    int val = mpds.qvers == qvers;
616
    int val = mpds.qvers == qvers;
617
    data.addarg("Value", SoapArgs::i2s(val));
617
    data.addarg("Value", SoapHelp::i2s(val));
618
618
619
    return ok ? UPNP_E_SUCCESS : UPNP_E_INTERNAL_ERROR;
619
    return ok ? UPNP_E_SUCCESS : UPNP_E_INTERNAL_ERROR;
620
}
620
}
621
621
622
int OHPlaylist::protocolInfo(const SoapArgs& sc, SoapData& data)
622
int OHPlaylist::protocolInfo(const SoapArgs& sc, SoapData& data)