From ccbf0f50bd899c4023036998a738ea97b17ba8f3 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 7 Oct 2012 23:06:27 +0530 Subject: [PATCH] Follow the remove_empty_feeds option when using ignore_duplicate_articles --- src/calibre/web/feeds/news.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/calibre/web/feeds/news.py b/src/calibre/web/feeds/news.py index 5502244007..14834ff88c 100644 --- a/src/calibre/web/feeds/news.py +++ b/src/calibre/web/feeds/news.py @@ -167,9 +167,10 @@ class BasicNewsRecipe(Recipe): extra_css = None #: If True empty feeds are removed from the output. - #: This option has no effect if parse_index is overriden in + #: This option has no effect if parse_index is overridden in #: the sub class. It is meant only for recipes that return a list - #: of feeds using `feeds` or :meth:`get_feeds`. + #: of feeds using `feeds` or :meth:`get_feeds`. It is also used if you use + #: the ignore_duplicate_articles option. remove_empty_feeds = False #: List of regular expressions that determines which links to follow @@ -1047,6 +1048,10 @@ class BasicNewsRecipe(Recipe): article.title, feed.title)) feed.remove_article(article) + if self.remove_empty_feeds: + feeds = [f for f in feeds if len(f) > 0] + return feeds + def build_index(self): self.report_progress(0, _('Fetching feeds...')) try: @@ -1061,7 +1066,7 @@ class BasicNewsRecipe(Recipe): raise ValueError('No articles found, aborting') if self.ignore_duplicate_articles is not None: - self.remove_duplicate_articles(feeds) + feeds = self.remove_duplicate_articles(feeds) #feeds = FeedCollection(feeds)