Skip to content

Commit

Permalink
siteamps discovery is optional because it often takes long time for m…
Browse files Browse the repository at this point in the history
…any websites (sitemaps can be huge)
  • Loading branch information
martinrotter committed Nov 1, 2023
1 parent 4057add commit 9eb41f7
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 6 deletions.
8 changes: 7 additions & 1 deletion src/librssguard/services/standard/gui/formdiscoverfeeds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,15 @@ QList<StandardFeed*> FormDiscoverFeeds::discoverFeedsWithParser(const FeedParser

void FormDiscoverFeeds::discoverFeeds() {
QString url = m_ui.m_txtUrl->lineEdit()->text();
bool sitemap_discover = m_ui.m_cbDiscoverSitemaps->isChecked();

std::function<QList<StandardFeed*>(const FeedParser*)> func = [=](const FeedParser* parser) -> QList<StandardFeed*> {
return discoverFeedsWithParser(parser, url);
if (!sitemap_discover && dynamic_cast<const SitemapParser*>(parser) != nullptr) {
return {};
}
else {
return discoverFeedsWithParser(parser, url);
}
};

std::function<QList<StandardFeed*>(QList<StandardFeed*>&, const QList<StandardFeed*>&)> reducer =
Expand Down
2 changes: 1 addition & 1 deletion src/librssguard/services/standard/gui/formdiscoverfeeds.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class DiscoveredFeedsModel : public AccountCheckModel {
virtual int columnCount(const QModelIndex& parent) const;
virtual QVariant data(const QModelIndex& index, int role) const;

RootItem* removeItem(RootItem *it);
RootItem* removeItem(RootItem* it);
RootItem* removeItem(const QModelIndex& idx);
};

Expand Down
13 changes: 10 additions & 3 deletions src/librssguard/services/standard/gui/formdiscoverfeeds.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>593</width>
<height>360</height>
<height>394</height>
</rect>
</property>
<property name="windowTitle">
Expand Down Expand Up @@ -46,6 +46,13 @@
</layout>
</item>
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="m_cbDiscoverSitemaps">
<property name="text">
<string>Discover Sitemaps too (can take some time for bigger websites)</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QProgressBar" name="m_pbDiscovery">
<property name="maximumSize">
<size>
Expand All @@ -58,7 +65,7 @@
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<item row="3" column="0" colspan="2">
<widget class="QGroupBox" name="m_gbFeeds">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
Expand Down Expand Up @@ -209,7 +216,7 @@
</layout>
</widget>
</item>
<item row="3" column="0" colspan="2">
<item row="4" column="0" colspan="2">
<widget class="QDialogButtonBox" name="m_buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
Expand Down
5 changes: 5 additions & 0 deletions src/librssguard/services/standard/parsers/feedparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ QList<StandardFeed*> FeedParser::discoverFeeds(ServiceRoot* root, const QUrl& ur
return {};
}

QPair<StandardFeed*, QList<IconLocation>> FeedParser::guessFeed(const QByteArray& content,
const QString& content_type) const {
return {};
}

QString FeedParser::xmlMessageRawContents(const QDomElement& msg_element) const {
QString raw_contents;
QTextStream str(&raw_contents);
Expand Down
2 changes: 1 addition & 1 deletion src/librssguard/services/standard/parsers/feedparser.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class FeedParser {

// Guesses feed.
virtual QPair<StandardFeed*, QList<IconLocation>> guessFeed(const QByteArray& content,
const QString& content_type) const = 0;
const QString& content_type) const;

// Returns list of all messages from the feed.
virtual QList<Message> messages();
Expand Down

0 comments on commit 9eb41f7

Please sign in to comment.