Allow to restart mid-day without re-tooting the whole day.

This commit is contained in:
Julien Palard 2023-02-11 08:01:26 +01:00
parent 0df5876fbd
commit b852ab1613
Signed by: mdk
GPG Key ID: 0EFC1AC1006886F8
1 changed files with 3 additions and 0 deletions

View File

@ -144,6 +144,9 @@ def live_toot(talks, mastodon: Mastodon, ahead_days=0):
delta = (
talk.start_date - datetime.now(timezone.utc) - timedelta(days=ahead_days)
)
if delta.total_seconds() < -300:
logging.info("Skipping %s (already happened).", talk.title)
continue
if delta.total_seconds() > 10:
logging.info("Waiting %s for %s to start.", delta, talk.title)
sleep(delta.total_seconds() - 2) # Wait for the talk to start.