When parsing podcast RSS, if episode is marked as video (e.g. video/mp4) but the url ends in an audio extension then use it is proably an audio podcast.

BUG: 588
This commit is contained in:
craig.p.drummond
2014-11-17 14:58:23 +00:00
committed by craig.p.drummond
parent f311076d2f
commit 3cc814df2a
2 changed files with 24 additions and 12 deletions

View File

@@ -117,7 +117,17 @@ static Episode parseEpisode(QXmlStreamReader &reader)
if (type.startsWith(QLatin1String("audio/")) || audioFormats.contains(type)) {
ep.url=QUrl::fromEncoded(reader.attributes().value(QLatin1String("url")).toString().toLatin1());
} else if (type.startsWith(QLatin1String("video/")) ) {
ep.video=true;
// At least one broken feed (BUG: 588) has the audio podcast listed as video/mp4,
// ...but the path ends in .mp3 !!!
QUrl url=QUrl::fromEncoded(reader.attributes().value(QLatin1String("url")).toString().toLatin1());
QString path=url.path();
if (path.endsWith(QLatin1String(".mp3"), Qt::CaseInsensitive) ||
path.endsWith(QLatin1String(".ogg"), Qt::CaseInsensitive) ||
path.endsWith(QLatin1String(".wma"), Qt::CaseInsensitive)) {
ep.url=url;
} else {
ep.video=true;
}
}
consumeCurrentElement(reader);
} else if (QLatin1String("pubDate")==name) {