mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 07:18:08 +00:00
- Fix RSS Feed downloader for RSS with no torrent attachment (but articles link points to the torrent instead)
This commit is contained in:
parent
e2c3e6dbaa
commit
141d3b6737
Binary file not shown.
Before Width: | Height: | Size: 743 B |
Binary file not shown.
Before Width: | Height: | Size: 659 B |
@ -144,7 +144,6 @@
|
|||||||
<file>Icons/oxygen/encrypted.png</file>
|
<file>Icons/oxygen/encrypted.png</file>
|
||||||
<file>Icons/oxygen/edit_clear.png</file>
|
<file>Icons/oxygen/edit_clear.png</file>
|
||||||
<file>Icons/oxygen/download.png</file>
|
<file>Icons/oxygen/download.png</file>
|
||||||
<file>Icons/oxygen/application-x-kgetlist-no.png</file>
|
|
||||||
<file>Icons/oxygen/gear.png</file>
|
<file>Icons/oxygen/gear.png</file>
|
||||||
<file>Icons/oxygen/remove.png</file>
|
<file>Icons/oxygen/remove.png</file>
|
||||||
<file>Icons/oxygen/dialog-warning.png</file>
|
<file>Icons/oxygen/dialog-warning.png</file>
|
||||||
@ -165,7 +164,6 @@
|
|||||||
<file>Icons/oxygen/help-about.png</file>
|
<file>Icons/oxygen/help-about.png</file>
|
||||||
<file>Icons/oxygen/list-add.png</file>
|
<file>Icons/oxygen/list-add.png</file>
|
||||||
<file>Icons/oxygen/network-server.png</file>
|
<file>Icons/oxygen/network-server.png</file>
|
||||||
<file>Icons/oxygen/application-x-kgetlist.png</file>
|
|
||||||
<file>Icons/oxygen/folder.png</file>
|
<file>Icons/oxygen/folder.png</file>
|
||||||
<file>Icons/oxygen/urlseed.png</file>
|
<file>Icons/oxygen/urlseed.png</file>
|
||||||
<file>Icons/oxygen/edit-cut.png</file>
|
<file>Icons/oxygen/edit-cut.png</file>
|
||||||
|
17
src/rss.cpp
17
src/rss.cpp
@ -376,7 +376,6 @@ void RssManager::saveStreamList(){
|
|||||||
/** RssStream **/
|
/** RssStream **/
|
||||||
|
|
||||||
RssStream::RssStream(RssFolder* parent, RssManager *rssmanager, Bittorrent *BTSession, QString _url): parent(parent), rssmanager(rssmanager), BTSession(BTSession), alias(""), iconPath(":/Icons/rss16.png"), refreshed(false), downloadFailure(false), currently_loading(false) {
|
RssStream::RssStream(RssFolder* parent, RssManager *rssmanager, Bittorrent *BTSession, QString _url): parent(parent), rssmanager(rssmanager), BTSession(BTSession), alias(""), iconPath(":/Icons/rss16.png"), refreshed(false), downloadFailure(false), currently_loading(false) {
|
||||||
has_attachments = false;
|
|
||||||
qDebug("RSSStream constructed");
|
qDebug("RSSStream constructed");
|
||||||
QSettings qBTRSS("qBittorrent", "qBittorrent-rss");
|
QSettings qBTRSS("qBittorrent", "qBittorrent-rss");
|
||||||
url = QUrl(_url).toString();
|
url = QUrl(_url).toString();
|
||||||
@ -388,8 +387,6 @@ RssStream::RssStream(RssFolder* parent, RssManager *rssmanager, Bittorrent *BTSe
|
|||||||
RssItem *rss_item = RssItem::fromHash(this, item);
|
RssItem *rss_item = RssItem::fromHash(this, item);
|
||||||
if(rss_item->isValid()) {
|
if(rss_item->isValid()) {
|
||||||
(*this)[rss_item->getTitle()] = rss_item;
|
(*this)[rss_item->getTitle()] = rss_item;
|
||||||
if(rss_item->has_attachment())
|
|
||||||
has_attachments = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -584,8 +581,11 @@ short RssStream::readDoc(const QDomDocument& doc) {
|
|||||||
delete item;
|
delete item;
|
||||||
item = this->value(title);
|
item = this->value(title);
|
||||||
}
|
}
|
||||||
if(item->has_attachment()) {
|
QString torrent_url;
|
||||||
has_attachments = true;
|
if(item->has_attachment())
|
||||||
|
torrent_url = item->getTorrentUrl();
|
||||||
|
else
|
||||||
|
torrent_url = item->getLink();
|
||||||
// Check if the item should be automatically downloaded
|
// Check if the item should be automatically downloaded
|
||||||
if(!already_exists || !(*this)[item->getTitle()]->isRead()) {
|
if(!already_exists || !(*this)[item->getTitle()]->isRead()) {
|
||||||
FeedFilter * matching_filter = FeedFilters::getFeedFilters(url).matches(item->getTitle());
|
FeedFilter * matching_filter = FeedFilters::getFeedFilters(url).matches(item->getTitle());
|
||||||
@ -595,12 +595,12 @@ short RssStream::readDoc(const QDomDocument& doc) {
|
|||||||
if(matching_filter->isValid()) {
|
if(matching_filter->isValid()) {
|
||||||
QString save_path = matching_filter->getSavePath();
|
QString save_path = matching_filter->getSavePath();
|
||||||
if(save_path.isEmpty())
|
if(save_path.isEmpty())
|
||||||
BTSession->downloadUrlAndSkipDialog(item->getTorrentUrl());
|
BTSession->downloadUrlAndSkipDialog(torrent_url);
|
||||||
else
|
else
|
||||||
BTSession->downloadUrlAndSkipDialog(item->getTorrentUrl(), save_path);
|
BTSession->downloadUrlAndSkipDialog(torrent_url, save_path);
|
||||||
} else {
|
} else {
|
||||||
// All torrents are downloaded from this feed
|
// All torrents are downloaded from this feed
|
||||||
BTSession->downloadUrlAndSkipDialog(item->getTorrentUrl());
|
BTSession->downloadUrlAndSkipDialog(torrent_url);
|
||||||
}
|
}
|
||||||
// Item was downloaded, consider it as Read
|
// Item was downloaded, consider it as Read
|
||||||
(*this)[item->getTitle()]->setRead();
|
(*this)[item->getTitle()]->setRead();
|
||||||
@ -608,7 +608,6 @@ short RssStream::readDoc(const QDomDocument& doc) {
|
|||||||
delete matching_filter;
|
delete matching_filter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
delete item;
|
delete item;
|
||||||
|
@ -394,7 +394,6 @@ private:
|
|||||||
bool refreshed;
|
bool refreshed;
|
||||||
bool downloadFailure;
|
bool downloadFailure;
|
||||||
bool currently_loading;
|
bool currently_loading;
|
||||||
bool has_attachments;
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void processDownloadedFile(QString file_path);
|
void processDownloadedFile(QString file_path);
|
||||||
@ -430,7 +429,6 @@ public:
|
|||||||
QList<RssItem*> getNewsList() const;
|
QList<RssItem*> getNewsList() const;
|
||||||
QList<RssItem*> getUnreadNewsList() const;
|
QList<RssItem*> getUnreadNewsList() const;
|
||||||
QString getIconUrl();
|
QString getIconUrl();
|
||||||
bool hasAttachments() const { return has_attachments; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
short readDoc(const QDomDocument& doc);
|
short readDoc(const QDomDocument& doc);
|
||||||
|
@ -71,12 +71,10 @@ void RSSImp::displayRSSListMenu(const QPoint& pos){
|
|||||||
myRSSListMenu.addSeparator();
|
myRSSListMenu.addSeparator();
|
||||||
myRSSListMenu.addAction(actionCopy_feed_URL);
|
myRSSListMenu.addAction(actionCopy_feed_URL);
|
||||||
if(selectedItems.size() == 1) {
|
if(selectedItems.size() == 1) {
|
||||||
if(((RssStream*)listStreams->getRSSItem(selectedItems.first()))->hasAttachments()) {
|
|
||||||
myRSSListMenu.addSeparator();
|
myRSSListMenu.addSeparator();
|
||||||
myRSSListMenu.addAction(actionRSS_feed_downloader);
|
myRSSListMenu.addAction(actionRSS_feed_downloader);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}else{
|
}else{
|
||||||
myRSSListMenu.addAction(actionNew_subscription);
|
myRSSListMenu.addAction(actionNew_subscription);
|
||||||
myRSSListMenu.addAction(actionNew_folder);
|
myRSSListMenu.addAction(actionNew_folder);
|
||||||
@ -293,9 +291,7 @@ void RSSImp::downloadTorrent() {
|
|||||||
if(article->has_attachment()) {
|
if(article->has_attachment()) {
|
||||||
BTSession->downloadFromUrl(article->getTorrentUrl());
|
BTSession->downloadFromUrl(article->getTorrentUrl());
|
||||||
} else {
|
} else {
|
||||||
QString link = article->getLink();
|
BTSession->downloadFromUrl(article->getLink());
|
||||||
if(!link.isEmpty())
|
|
||||||
QDesktopServices::openUrl(QUrl(link));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -444,10 +440,6 @@ void RSSImp::refreshNewsList(QTreeWidgetItem* item) {
|
|||||||
foreach(RssItem* article, news){
|
foreach(RssItem* article, news){
|
||||||
QTreeWidgetItem* it = new QTreeWidgetItem(listNews);
|
QTreeWidgetItem* it = new QTreeWidgetItem(listNews);
|
||||||
it->setText(NEWS_TITLE_COL, article->getTitle());
|
it->setText(NEWS_TITLE_COL, article->getTitle());
|
||||||
if(article->has_attachment())
|
|
||||||
it->setData(NEWS_TITLE_COL, Qt::DecorationRole, QVariant(QIcon(":/Icons/oxygen/application-x-kgetlist.png")));
|
|
||||||
else
|
|
||||||
it->setData(NEWS_TITLE_COL, Qt::DecorationRole, QVariant(QIcon(":/Icons/oxygen/application-x-kgetlist-no.png")));
|
|
||||||
it->setText(NEWS_URL_COL, article->getParent()->getUrl());
|
it->setText(NEWS_URL_COL, article->getParent()->getUrl());
|
||||||
if(article->isRead()){
|
if(article->isRead()){
|
||||||
it->setData(NEWS_TITLE_COL, Qt::ForegroundRole, QVariant(QColor("grey")));
|
it->setData(NEWS_TITLE_COL, Qt::ForegroundRole, QVariant(QColor("grey")));
|
||||||
|
Loading…
Reference in New Issue
Block a user