From 628e17cdf1e0e89c6b1ad7c087b9e345f3c75e16 Mon Sep 17 00:00:00 2001 From: Adam Sampson Date: Sun, 16 Jan 2005 21:05:34 +0000 Subject: [PATCH] Rework currentonly code to update articles rather than adding them each time. --- NEWS | 3 +++ rawdoglib/rawdog.py | 12 +++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index a909233..38facd1 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,9 @@ Provide guid in item templates (suggested by Rick van Rein). +Update article-added dates correctly when "currentonly true" is used +(reported by Rick van Rein). + - rawdog 2.3 Make the id= parameter work correctly (patch from Jon Nelson). diff --git a/rawdoglib/rawdog.py b/rawdoglib/rawdog.py index d6c1431..00c19fc 100644 --- a/rawdoglib/rawdog.py +++ b/rawdoglib/rawdog.py @@ -341,11 +341,7 @@ class Feed: self.feed_info = p["feed"] feed = self.url - if config["currentonly"]: - for (hash, a) in articles.items(): - if a.feed == feed: - del articles[hash] - + seen = {} sequence = 0 for entry_info in p["entries"]: article = Article(feed, entry_info, now, sequence) @@ -353,6 +349,7 @@ class Feed: plugins.call_hook("article_seen", rawdog, config, article, ignore) if ignore.value: continue + seen[article.hash] = True sequence += 1 if articles.has_key(article.hash): @@ -362,6 +359,11 @@ class Feed: articles[article.hash] = article plugins.call_hook("article_added", rawdog, config, article, now) + if config["currentonly"]: + for (hash, a) in articles.items(): + if a.feed == feed and not seen.has_key(hash): + del articles[hash] + return True def get_html_name(self, config): -- 2.35.1