Select first enclosure if entry has multiple enclosure entries

Kasts can currently only handle one enclosure per entry.  In case an
entry/item has multiple enclosures, it's probably safe to assume that the
first one is the one that's preferred by the author.

CCBUG: 440389
This commit is contained in:
Bart De Vries 2021-07-30 14:20:51 +02:00
parent 6eb13167f2
commit 0b33c62a10
1 changed files with 5 additions and 2 deletions

View File

@ -303,8 +303,11 @@ bool Fetcher::processEntry(Syndication::ItemPtr entry, const QString &url, bool
processAuthor(url, entry->id(), authorName, QLatin1String(""), QLatin1String(""));
}
for (const auto &enclosure : entry->enclosures()) {
processEnclosure(enclosure, entry, url);
// only process first enclosure if there are multiple (e.g. mp3 and ogg);
// the first one is probably the podcast author's preferred version
// TODO: handle more than one enclosure?
if (entry->enclosures().count() > 0) {
processEnclosure(entry->enclosures()[0], entry, url);
}
Q_EMIT entryAdded(url, entry->id());