mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-10 23:07:59 +00:00
- Make sure RSS Feed downloader does not process already-read articles
This commit is contained in:
parent
9b4cfa4a3d
commit
53171c81e1
42
src/rss.cpp
42
src/rss.cpp
@ -561,31 +561,37 @@ short RssStream::readDoc(const QDomDocument& doc) {
|
|||||||
image = property.text();
|
image = property.text();
|
||||||
else if(property.tagName() == "item") {
|
else if(property.tagName() == "item") {
|
||||||
RssItem * item = new RssItem(this, property);
|
RssItem * item = new RssItem(this, property);
|
||||||
if(item->isValid() && !itemAlreadyExists(item->getTitle())) {
|
if(item->isValid()) {
|
||||||
(*this)[item->getTitle()] = item;
|
bool already_exists = itemAlreadyExists(item->getTitle());
|
||||||
|
if(!already_exists) {
|
||||||
|
(*this)[item->getTitle()] = item;
|
||||||
|
}
|
||||||
if(item->has_attachment()) {
|
if(item->has_attachment()) {
|
||||||
has_attachments = true;
|
has_attachments = true;
|
||||||
// Check if the item should be automatically downloaded
|
// Check if the item should be automatically downloaded
|
||||||
FeedFilter * matching_filter = FeedFilters::getFeedFilters(url).matches(item->getTitle());
|
if(!already_exists || !(*this)[item->getTitle()]->isRead()) {
|
||||||
if(matching_filter != 0) {
|
FeedFilter * matching_filter = FeedFilters::getFeedFilters(url).matches(item->getTitle());
|
||||||
// Download the torrent
|
if(matching_filter != 0) {
|
||||||
BTSession->addConsoleMessage(tr("Automatically downloading %1 torrent from %2 RSS feed...").arg(item->getTitle()).arg(getName()));
|
// Download the torrent
|
||||||
if(matching_filter->isValid()) {
|
BTSession->addConsoleMessage(tr("Automatically downloading %1 torrent from %2 RSS feed...").arg(item->getTitle()).arg(getName()));
|
||||||
QString save_path = matching_filter->getSavePath();
|
if(matching_filter->isValid()) {
|
||||||
if(save_path.isEmpty())
|
QString save_path = matching_filter->getSavePath();
|
||||||
|
if(save_path.isEmpty())
|
||||||
|
BTSession->downloadUrlAndSkipDialog(item->getTorrentUrl());
|
||||||
|
else
|
||||||
|
BTSession->downloadUrlAndSkipDialog(item->getTorrentUrl(), save_path);
|
||||||
|
} else {
|
||||||
|
// All torrents are downloaded from this feed
|
||||||
BTSession->downloadUrlAndSkipDialog(item->getTorrentUrl());
|
BTSession->downloadUrlAndSkipDialog(item->getTorrentUrl());
|
||||||
else
|
}
|
||||||
BTSession->downloadUrlAndSkipDialog(item->getTorrentUrl(), save_path);
|
// Item was downloaded, consider it as Read
|
||||||
} else {
|
(*this)[item->getTitle()]->setRead();
|
||||||
// All torrents are downloaded from this feed
|
// Clean up
|
||||||
BTSession->downloadUrlAndSkipDialog(item->getTorrentUrl());
|
delete matching_filter;
|
||||||
}
|
}
|
||||||
// Item was downloaded, consider it as Read
|
|
||||||
item->setRead();
|
|
||||||
// Clean up
|
|
||||||
delete matching_filter;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
delete item;
|
delete item;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user