# HG changeset patch # User Malcolm Matalka # Date 1588524598 -7200 # Sun May 03 18:49:58 2020 +0200 # Node ID a774d362d9cf000b3f88d3d290a820a12ad4c77d # Parent 9ffd8676f910798752862af546f850b737af0955 FIX Use the maximum time for a feed when storing DB diff --git a/feed2maildir/converter.py b/feed2maildir/converter.py --- a/feed2maildir/converter.py +++ b/feed2maildir/converter.py @@ -126,7 +126,7 @@ oldtime = None if oldtime and not oldtime.tzinfo: # force UTC oldtime = oldtime.replace(tzinfo=dateutil.tz.tzutc()) - # print(feedname, feedup.tzinfo) + if not oldtime or oldtime < feedup: for post in feed.entries: feedtime = self.post_update_time(post) @@ -143,7 +143,11 @@ post.link)) new.setdefault(feedname, []).append(post) - newtimes[feedname] = feedup.strftime('%Y-%m-%d %H:%M:%S %Z') + if oldtime is not None: + newtimes[feedname] = max(oldtime, feedup).strftime('%Y-%m-%d %H:%M:%S %Z') + else: + newtimes[feedname] = feedup.strftime('%Y-%m-%d %H:%M:%S %Z') + self.output('Feedname : {} : Feedup : {}'.format(feedname, newtimes[feedname])) return (new, newtimes)