Add support for images from MRSS thumbnail tag

This commit is contained in:
Bart De Vries 2021-11-15 14:10:46 +01:00
parent 19d7a2c12b
commit 9c2d7adf55
1 changed files with 9 additions and 1 deletions

View File

@ -224,6 +224,11 @@ bool UpdateFeedJob::processEntry(Syndication::ItemPtr entry)
// Retrieve "other" fields; this will include the "itunes" tags
QMultiMap<QString, QDomElement> otherItems = entry->additionalProperties();
for (QString key : otherItems.uniqueKeys()) {
qCDebug(kastsFetcher) << "other elements";
qCDebug(kastsFetcher) << key << otherItems.value(key).tagName();
}
// check against existing entries in database
if (m_existingEntryIds.contains(entry->id()))
return false;
@ -253,9 +258,12 @@ bool UpdateFeedJob::processEntry(Syndication::ItemPtr entry)
// Look for image in itunes tags
if (otherItems.value(QStringLiteral("http://www.itunes.com/dtds/podcast-1.0.dtdimage")).hasAttribute(QStringLiteral("href"))) {
entryDetails.image = otherItems.value(QStringLiteral("http://www.itunes.com/dtds/podcast-1.0.dtdimage")).attribute(QStringLiteral("href"));
} else if (otherItems.contains(QStringLiteral("http://search.yahoo.com/mrss/thumbnail"))) {
entryDetails.image = otherItems.value(QStringLiteral("http://search.yahoo.com/mrss/thumbnail")).attribute(QStringLiteral("url"));
}
if (entryDetails.image.startsWith(QStringLiteral("/")))
if (entryDetails.image.startsWith(QStringLiteral("/"))) {
entryDetails.image = QUrl(m_url).adjusted(QUrl::RemovePath).toString() + entryDetails.image;
}
qCDebug(kastsFetcher) << "Entry image found" << entryDetails.image;
m_entries += entryDetails;