diff --git a/tootbot.py b/tootbot.py index 70c6084..ca31e41 100755 --- a/tootbot.py +++ b/tootbot.py @@ -98,7 +98,7 @@ for p in reversed(t.entries): # process only unprocessed tweets less than n days old if datetime.now() - posttime > timedelta(days=days): shouldpost = False - print("skip: Post too old") + print("skip: Tweet older than %s days" % days) # kill tweets with fb links with fire! if "https://www.facebook.com" in p.title or "https://m.facebook.com" in p.title: shouldpost = False @@ -180,9 +180,16 @@ for p in reversed(s.entries): ) last = db.fetchone() - # process only unprocessed post less than n days old - posttime = datetime(p.published_parsed.tm_year, p.published_parsed.tm_mon, p.published_parsed.tm_mday, p.published_parsed.tm_hour, p.published_parsed.tm_min, p.published_parsed.tm_sec) - if last is None and (datetime.now() - posttime < timedelta(days=days)): + + if last is not None: + shouldpost = False + print("skip: already posted") + # process only unprocessed tweets less than n days old + if datetime.now() - posttime > timedelta(days=days): + shouldpost = False + print("skip: Posting older than %s days" % days) + + if shouldpost: # Create application if it does not exist mastodon_api = register_app(mastuser, mastpasswd, mastinstance, mastodon_api)