mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-29 19:18:42 -07:00
RSS code clean up
- Also drops support for Qt 4.5
This commit is contained in:
parent
f3448125c3
commit
8e529fc179
13 changed files with 70 additions and 138 deletions
|
@ -220,39 +220,30 @@ RssArticlePtr xmlToRssArticle(RssFeed* parent, QXmlStreamReader& xml)
|
|||
QDateTime date;
|
||||
QString author;
|
||||
|
||||
while(!xml.atEnd()) {
|
||||
xml.readNext();
|
||||
Q_ASSERT(xml.isStartElement() && xml.name() == "item");
|
||||
|
||||
if (xml.isEndElement() && xml.name() == "item")
|
||||
break;
|
||||
|
||||
if (xml.isStartElement()) {
|
||||
if (xml.name() == "title") {
|
||||
title = xml.readElementText();
|
||||
}
|
||||
else if (xml.name() == "enclosure") {
|
||||
if (xml.attributes().value("type") == "application/x-bittorrent") {
|
||||
torrentUrl = xml.attributes().value("url").toString();
|
||||
}
|
||||
}
|
||||
else if (xml.name() == "link") {
|
||||
link = xml.readElementText();
|
||||
if (guid.isEmpty())
|
||||
guid = link;
|
||||
}
|
||||
else if (xml.name() == "description") {
|
||||
description = xml.readElementText();
|
||||
}
|
||||
else if (xml.name() == "pubDate") {
|
||||
date = RssArticle::parseDate(xml.readElementText());
|
||||
}
|
||||
else if (xml.name() == "author") {
|
||||
author = xml.readElementText();
|
||||
}
|
||||
else if (xml.name() == "guid") {
|
||||
guid = xml.readElementText();
|
||||
}
|
||||
while (xml.readNextStartElement()) {
|
||||
if (xml.name() == "title")
|
||||
title = xml.readElementText();
|
||||
else if (xml.name() == "enclosure") {
|
||||
if (xml.attributes().value("type") == "application/x-bittorrent")
|
||||
torrentUrl = xml.attributes().value("url").toString();
|
||||
}
|
||||
else if (xml.name() == "link") {
|
||||
link = xml.readElementText();
|
||||
if (guid.isEmpty())
|
||||
guid = link;
|
||||
}
|
||||
else if (xml.name() == "description")
|
||||
description = xml.readElementText();
|
||||
else if (xml.name() == "pubDate")
|
||||
date = RssArticle::parseDate(xml.readElementText());
|
||||
else if (xml.name() == "author")
|
||||
author = xml.readElementText();
|
||||
else if (xml.name() == "guid")
|
||||
guid = xml.readElementText();
|
||||
else
|
||||
xml.skipCurrentElement();
|
||||
}
|
||||
|
||||
if (guid.isEmpty())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue