Commit a801a575 authored by Urs Fleisch's avatar Urs Fleisch
Browse files

replace also numerical HTML entities in Discogs and Amazon import

parent 43762835
......@@ -451,7 +451,7 @@ void DiscogsDialog::parseAlbumResults(const QByteArray& albumStr)
int duration = 0;
int pos = trackNr;
if (titleRe.QCM_indexIn(trackDataStr) >= 0) {
title = titleRe.cap(1);
title = removeHtml(titleRe.cap(1));
}
if (durationRe.QCM_indexIn(trackDataStr) >= 0) {
duration = durationRe.cap(1).toInt() * 60 +
......@@ -472,7 +472,7 @@ void DiscogsDialog::parseAlbumResults(const QByteArray& albumStr)
start = end + 10; // skip </td></tr>
if (indexRe.QCM_indexIn(trackDataStr) >= 0) {
if (additionalTags) {
QString subtitle(indexRe.cap(1));
QString subtitle(removeHtml(indexRe.cap(1)));
framesHdr.setValue(Frame::FT_Part, subtitle);
frames.setValue(Frame::FT_Part, subtitle);
}
......
......@@ -501,6 +501,14 @@ QString ImportSourceDialog::replaceHtmlEntities(QString str)
str.replace("&lt;", "<");
str.replace("&gt;", ">");
str.replace("&amp;", "&");
QRegExp numEntityRe("&#(\\d+);");
int pos = 0;
while ((pos = numEntityRe.QCM_indexIn(str, pos)) != -1) {
str.replace(pos, numEntityRe.matchedLength(),
QChar(numEntityRe.cap(1).toInt()));
pos += numEntityRe.matchedLength();
}
return str;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment