mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-10-22 10:46:04 +03:00
[RSS] Improve error handling when a RSS feed doesn't contain torrents
This commit is contained in:
parent
6dc82df368
commit
7cecad4e82
3 changed files with 10 additions and 2 deletions
|
@ -352,6 +352,8 @@ void RSSImp::downloadSelectedTorrents()
|
||||||
RssArticlePtr article = feed->getItem(item->data(Article::IdRole).toString());
|
RssArticlePtr article = feed->getItem(item->data(Article::IdRole).toString());
|
||||||
if (!article) continue;
|
if (!article) continue;
|
||||||
|
|
||||||
|
if (article->torrentUrl().isEmpty())
|
||||||
|
continue;
|
||||||
QString torrentLink = article->torrentUrl();
|
QString torrentLink = article->torrentUrl();
|
||||||
// Check if it is a magnet link
|
// Check if it is a magnet link
|
||||||
if (torrentLink.startsWith("magnet:", Qt::CaseInsensitive)) {
|
if (torrentLink.startsWith("magnet:", Qt::CaseInsensitive)) {
|
||||||
|
|
|
@ -82,7 +82,7 @@ const QString& RssArticle::author() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString& RssArticle::torrentUrl() const {
|
const QString& RssArticle::torrentUrl() const {
|
||||||
return m_torrentUrl.isEmpty() ? m_link : m_torrentUrl;
|
return m_torrentUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString& RssArticle::link() const {
|
const QString& RssArticle::link() const {
|
||||||
|
@ -123,6 +123,6 @@ const QString& RssArticle::title() const
|
||||||
}
|
}
|
||||||
|
|
||||||
void RssArticle::handleTorrentDownloadSuccess(const QString &url) {
|
void RssArticle::handleTorrentDownloadSuccess(const QString &url) {
|
||||||
if (url == m_torrentUrl || url == m_link)
|
if (url == m_torrentUrl)
|
||||||
markAsRead();
|
markAsRead();
|
||||||
}
|
}
|
||||||
|
|
|
@ -367,6 +367,12 @@ void RssFeed::downloadArticleTorrentIfMatching(RssDownloadRuleList* rules, const
|
||||||
rules->saveRulesToStorage();
|
rules->saveRulesToStorage();
|
||||||
// Download the torrent
|
// Download the torrent
|
||||||
const QString& torrent_url = article->torrentUrl();
|
const QString& torrent_url = article->torrentUrl();
|
||||||
|
if (torrent_url.isEmpty()) {
|
||||||
|
Logger::instance()->addMessage(tr("Automatic download %1 from %2 RSS feed failed because it doesn't contain a torrent or a magnet link...").arg(article->title()).arg(displayName()), Log::WARNING);
|
||||||
|
article->markAsRead();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Logger::instance()->addMessage(tr("Automatically downloading %1 torrent from %2 RSS feed...").arg(article->title()).arg(displayName()));
|
Logger::instance()->addMessage(tr("Automatically downloading %1 torrent from %2 RSS feed...").arg(article->title()).arg(displayName()));
|
||||||
connect(QBtSession::instance(), SIGNAL(newDownloadedTorrentFromRss(QString)), article.data(), SLOT(handleTorrentDownloadSuccess(const QString&)), Qt::UniqueConnection);
|
connect(QBtSession::instance(), SIGNAL(newDownloadedTorrentFromRss(QString)), article.data(), SLOT(handleTorrentDownloadSuccess(const QString&)), Qt::UniqueConnection);
|
||||||
connect(article.data(), SIGNAL(articleWasRead()), SLOT(handleArticleStateChanged()), Qt::UniqueConnection);
|
connect(article.data(), SIGNAL(articleWasRead()), SLOT(handleArticleStateChanged()), Qt::UniqueConnection);
|
||||||
|
|
Loading…
Reference in a new issue