diff --git a/src/playlist.cpp b/src/playlist.cpp index 4613228..6a14613 100644 --- a/src/playlist.cpp +++ b/src/playlist.cpp @@ -135,6 +135,7 @@ void xmlcb(uint8_t status, char* tagName, uint16_t tagLen, char* data, uint16_t xml_enclosure_url = ""; } else if (tag.endsWith("/item") && (status & STATUS_END_TAG)) { if (xml_title.length()>0 && xml_url.length()>0) { + if (xml_files_ptr->size() > 20) return; DEBUG("Adding playlist entry: '%s' => '%s'\n", xml_title.c_str(), xml_url.c_str()); xml_files_ptr->insert(xml_files_ptr->begin(), {.filename=xml_url, .title=xml_title, .id=xml_guid}); } @@ -158,6 +159,7 @@ void Playlist::_parse_rss(HTTPClientWrapper* http) { while ((i = http->read()) >= 0) { xml.processChar(i); } + _current_track = _files.size()-1; xml_files_ptr = NULL; if (xml_album_title.length()>0) { _title = xml_album_title; @@ -326,7 +328,7 @@ void Playlist::advent_shuffle(uint8_t day) { // We are in the "different playlist every day" mode. So we don't persist it in order to not miss changes. persistence = PERSIST_NONE; - + _files.insert(_files.begin(), _files[day - 1]); _files.erase(_files.begin() + day, _files.end()); @@ -382,6 +384,7 @@ void Playlist::json(JsonObject json) { JsonObject o = files.createNestedObject(); o["filename"] = entry.filename; o["title"] = entry.title; + o["id"] = entry.id; } json["current_track"] = _current_track; json["has_track_next"] = has_track_next();