From 13f708c3a7c91667ddb5728483188d50dccbb99d Mon Sep 17 00:00:00 2001 From: George Saunders Date: Fri, 22 Mar 2013 04:49:27 +0000 Subject: [PATCH] config and feed: Added trust-link preference The trust-link preference allows the user to ignore feed entries that repeat a previously seen link URL. Signed-off-by: George Saunders --- rss2email/config.py | 3 +++ rss2email/feed.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/rss2email/config.py b/rss2email/config.py index 6b5155f..1f9ebbe 100644 --- a/rss2email/config.py +++ b/rss2email/config.py @@ -107,6 +107,9 @@ CONFIG['DEFAULT'] = _collections.OrderedDict(( # True: Receive one email per post. # False: Receive an email every time a post changes. ('trust-guid', str(True)), + # True: Receive one email per unique link url. + # False: Defer to trust-guid preference. + ('trust-link', str(False)), # To most correctly encode emails with international # characters, we iterate through the list below and use the # first character set that works. diff --git a/rss2email/feed.py b/rss2email/feed.py index a11f6c7..ef4d770 100644 --- a/rss2email/feed.py +++ b/rss2email/feed.py @@ -180,6 +180,7 @@ class Feed (object): 'active', 'date_header', 'trust_guid', + 'trust_link', 'html_mail', 'use_css', 'unicode_snob', @@ -498,6 +499,8 @@ class Feed (object): def _get_entry_id(self, entry): """Get best ID from an entry.""" + if self.trust_link: + return entry.get('link', None) if self.trust_guid: if getattr(entry, 'id', None): # Newer versions of feedparser could return a dictionary -- 2.26.2