Switch to unified view

a/upmpd/ohplaylist.cxx b/upmpd/ohplaylist.cxx
...
...
132
            out1 += (unsigned char) ((val & 0xff000000) >> 24);
132
            out1 += (unsigned char) ((val & 0xff000000) >> 24);
133
            out1 += (unsigned char) ((val & 0x00ff0000) >> 16);
133
            out1 += (unsigned char) ((val & 0x00ff0000) >> 16);
134
            out1 += (unsigned char) ((val & 0x0000ff00) >> 8);
134
            out1 += (unsigned char) ((val & 0x0000ff00) >> 8);
135
            out1 += (unsigned char) ((val & 0x000000ff));
135
            out1 += (unsigned char) ((val & 0x000000ff));
136
        }
136
        }
137
        //sdeb += SoapArgs::i2s(val) + " ";
137
        sdeb += SoapArgs::i2s(val) + " ";
138
    }
138
    }
139
    //LOGDEB("OHPlaylist: current ids: " << sdeb << endl);
139
    LOGDEB("OHPlaylist: current ids: " << sdeb << endl);
140
    return base64_encode(out1);
140
    return base64_encode(out1);
141
}
141
}
142
142
143
bool OHPlaylist::makeIdArray(string& out)
143
bool OHPlaylist::makeIdArray(string& out)
144
{
144
{
...
...
172
            // Entries already in the metadata array just get
172
            // Entries already in the metadata array just get
173
            // transferred to the new array
173
            // transferred to the new array
174
            nmeta[usong.uri].swap(inold->second);
174
            nmeta[usong.uri].swap(inold->second);
175
            m_metacache.erase(inold);
175
            m_metacache.erase(inold);
176
        } else {
176
        } else {
177
            // Entries not in the old array are translated from the
177
            // Entries not in the arrays are translated from the
178
            // MPD data to our format. They were probably added by
178
            // MPD data to our format. They were probably added by
179
            // another MPD client. 
179
            // another MPD client. 
180
            if (nmeta.find(usong.uri) == nmeta.end()) {
180
            nmeta[usong.uri] = didlmake(usong);
181
                nmeta[usong.uri] = didlmake(usong);
181
            m_cachedirty = true;
182
                m_cachedirty = true;
182
            LOGDEB("OHPlaylist::makeIdArray: set mpd data for " << 
183
                LOGDEB("OHPlaylist::makeIdArray: using mpd data for " << 
183
                   usong.mpdid << endl);
184
                       usong.mpdid << " uri " << usong.uri << endl);
185
            }
184
        }
186
        }
187
    }
188
189
    for (unordered_map<string, string>::const_iterator it = m_metacache.begin();
190
         it != m_metacache.end(); it++) {
191
        LOGDEB("OHPlaylist::makeIdArray: dropping uri " << it->first << endl);
185
    }
192
    }
186
193
187
    // If we added entries or there are some stale entries, the new
194
    // If we added entries or there are some stale entries, the new
188
    // map differs, save it to cache
195
    // map differs, save it to cache
189
    if (!m_metacache.empty() || m_cachedirty) {
196
    if (!m_metacache.empty() || m_cachedirty) {
...
...
461
    string out("<TrackList>");
468
    string out("<TrackList>");
462
    if (ok) {
469
    if (ok) {
463
        stringToTokens(sids, ids);
470
        stringToTokens(sids, ids);
464
        for (auto& sid : ids) {
471
        for (auto& sid : ids) {
465
            int id = atoi(sid.c_str());
472
            int id = atoi(sid.c_str());
473
            if (id == -1) {
474
                // Lumin does this??
475
                LOGDEB("OHPlaylist::readlist: request for id -1" << endl);
476
                continue;
477
            }
466
            UpSong song;
478
            UpSong song;
467
            if (!m_dev->m_mpdcli->statSong(song, id, true))
479
            if (!m_dev->m_mpdcli->statSong(song, id, true))
468
                continue;
480
                continue;
469
            auto mit = m_metacache.find(song.uri);
481
            auto mit = m_metacache.find(song.uri);
470
            string metadata;
482
            string metadata;