TinyXML is broken, but I couldn't find an alternative nor fix it. So the code now is pretty hack-y to work around the bugs.
This commit is contained in:
parent
fe2a209e44
commit
23fbddb055
@ -109,35 +109,34 @@ void xmlcb(uint8_t status, char* tagName, uint16_t tagLen, char* data, uint16_t
|
|||||||
|
|
||||||
if (tag.equals("/rss/channel/title") && (status & STATUS_TAG_TEXT)) {
|
if (tag.equals("/rss/channel/title") && (status & STATUS_TAG_TEXT)) {
|
||||||
xml_album_title = data;
|
xml_album_title = data;
|
||||||
} else if (tag.endsWith("/item") && (status & STATUS_START_TAG)) {
|
} else if (tag.endsWith("/title") && (status & STATUS_TAG_TEXT)) {
|
||||||
xml_title = "";
|
|
||||||
xml_url = "";
|
|
||||||
xml_guid = "";
|
|
||||||
} else if (tag.endsWith("/item/title") && (status & STATUS_TAG_TEXT)) {
|
|
||||||
xml_title = String(data);
|
xml_title = String(data);
|
||||||
} else if (tag.endsWith("/item/guid") && (status & STATUS_TAG_TEXT)) {
|
} else if (tag.endsWith("/guid") && (status & STATUS_TAG_TEXT)) {
|
||||||
xml_guid = data;
|
xml_guid = data;
|
||||||
//} else if (xml_last_tag.endsWith("/item/enclosure") && (status & STATUS_ATTR_TEXT)) {
|
//} else if (xml_last_tag.endsWith("/item/enclosure") && (status & STATUS_ATTR_TEXT)) {
|
||||||
// DEBUG("tag: %s, data: %s\n", tag.c_str(), data);
|
// DEBUG("tag: %s, data: %s\n", tag.c_str(), data);
|
||||||
} else if (xml_last_tag.endsWith("/item/enclosure") && tag.equals("type") && (status & STATUS_ATTR_TEXT) && String(data).indexOf("audio/")>=0) {
|
} else if (xml_last_tag.endsWith("/enclosure") && tag.equals("type") && (status & STATUS_ATTR_TEXT) && String(data).indexOf("audio/")>=0) {
|
||||||
DEBUG("enclosure is audio\n");
|
DEBUG("enclosure is audio\n");
|
||||||
xml_enclosure_is_audio = true;
|
xml_enclosure_is_audio = true;
|
||||||
} else if (xml_last_tag.endsWith("/item/enclosure") && tag.equals("url") && (status & STATUS_ATTR_TEXT)) {
|
} else if (xml_last_tag.endsWith("/enclosure") && tag.equals("url") && (status & STATUS_ATTR_TEXT)) {
|
||||||
DEBUG("found url\n");
|
DEBUG("found url\n");
|
||||||
xml_enclosure_url = String(data);
|
xml_enclosure_url = String(data);
|
||||||
} else if (tag.endsWith("/item/enclosure") && (status & STATUS_END_TAG)) {
|
} else if (tag.endsWith("/enclosure") && (status & STATUS_END_TAG)) {
|
||||||
DEBUG("end of enclosure. xml_enclosure_is_audio: %d, xml_enclosure_url: %s\n", xml_enclosure_is_audio, xml_enclosure_url.c_str());
|
DEBUG("end of enclosure. xml_enclosure_is_audio: %d, xml_enclosure_url: %s\n", xml_enclosure_is_audio, xml_enclosure_url.c_str());
|
||||||
if (xml_enclosure_is_audio && xml_enclosure_url.length()>0) {
|
if (xml_enclosure_is_audio && xml_enclosure_url.length()>0) {
|
||||||
xml_url = xml_enclosure_url;
|
xml_url = xml_enclosure_url;
|
||||||
}
|
}
|
||||||
xml_enclosure_is_audio = false;
|
xml_enclosure_is_audio = false;
|
||||||
xml_enclosure_url = "";
|
xml_enclosure_url = "";
|
||||||
} else if (tag.endsWith("/item") && (status & STATUS_END_TAG)) {
|
} else if (tag.endsWith("/item") && (status & STATUS_END_TAG || status & STATUS_START_TAG)) {
|
||||||
if (xml_title.length()>0 && xml_url.length()>0) {
|
if (xml_title.length()>0 && xml_url.length()>0) {
|
||||||
if (xml_files_ptr->size() > 20) return;
|
if (xml_files_ptr->size() > 20) return;
|
||||||
DEBUG("Adding playlist entry: '%s' => '%s'\n", xml_title.c_str(), xml_url.c_str());
|
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});
|
xml_files_ptr->insert(xml_files_ptr->begin(), {.filename=xml_url, .title=xml_title, .id=xml_guid});
|
||||||
}
|
}
|
||||||
|
xml_title = "";
|
||||||
|
xml_url = "";
|
||||||
|
xml_guid = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user