From: Adam Sampson Date: Sun, 16 Jan 2005 21:05:34 +0000 (+0000) Subject: Rework currentonly code to update articles rather than adding them each X-Git-Tag: v2.4rc1~4 X-Git-Url: http://git.ozo.com/?a=commitdiff_plain;h=628e17cdf1e0e89c6b1ad7c087b9e345f3c75e16;p=rawdog%2F.git Rework currentonly code to update articles rather than adding them each time. --- 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):