1
0
mirror of https://github.com/clementine-player/Clementine synced 2024-12-22 15:58:45 +01:00

Added additional check when enclosure type is missing (#5934)

This commit is contained in:
Stephen Dawkins 2017-12-23 12:48:38 +00:00 committed by John Maguire
parent b724291ef9
commit d9b12a5599

View File

@ -229,9 +229,16 @@ void PodcastParser::ParseItem(QXmlStreamReader* reader, Podcast* ret) const {
}
} else if (name == "enclosure") {
const QString type = reader->attributes().value("type").toString();
const QUrl url = QUrl::fromEncoded(reader->attributes().value("url").toString().toAscii());
if (type.startsWith("audio/") || type.startsWith("x-audio/")) {
episode.set_url(QUrl::fromEncoded(
reader->attributes().value("url").toString().toAscii()));
episode.set_url(url);
}
// If the URL doesn't have a type, see if it's one of the obvious types
else if (type.isEmpty() && (
url.path().endsWith(".mp3", Qt::CaseInsensitive) ||
url.path().endsWith(".m4a", Qt::CaseInsensitive) ||
url.path().endsWith(".wav", Qt::CaseInsensitive))) {
episode.set_url(url);
}
Utilities::ConsumeCurrentElement(reader);
} else if (name == "author" && lower_namespace == kItunesNamespace) {