Fix: If last-updated is not given in config, no feeds are pushed.

The bug was: If last-updated was not given in the config, the current
date and time was used, inhibiting posting "old" entries.

Todo: Add an option to ask whether "old" entries shall be posted on
first run.
This commit is contained in:
Hartmut Goebel
2019-04-04 16:43:22 +02:00
parent e6a16dbe55
commit 2624eed96b

View File

@ -10,7 +10,7 @@ import feedparser
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
from mastodon import Mastodon from mastodon import Mastodon
from datetime import datetime, timezone from datetime import datetime, timezone, MINYEAR
import urllib3 import urllib3
@ -73,7 +73,8 @@ def read_config(config_file):
if 'updated' in config: if 'updated' in config:
config['updated'] = dateutil.parser.parse(config['updated']) config['updated'] = dateutil.parser.parse(config['updated'])
else: else:
config['updated'] = datetime.now(tz=timezone.utc) config['updated'] = datetime(MINYEAR, 1, 1,
0, 0, 0, 0, timezone.utc)
return config return config
def detect_generator(feed): def detect_generator(feed):