read TOP text from file

This commit is contained in:
2020-07-29 17:05:48 +02:00
parent e48490ffc1
commit 51df921038

View File

@@ -5,7 +5,7 @@ import email.header
import email.utils
import yaml
import datetime
import sys
import sys, os
import pypandoc
import argparse
import quopri
@@ -91,6 +91,12 @@ def conf2top(top):
except KeyError:
pass
if "file" in top:
try:
body = open(top["file"]).read()
except OSError as e:
print("Warning: Error opening", top["file"], file=sys.stderr)
return Top(top["title"], sender, body, protostub)
if __name__ == "__main__":
@@ -126,7 +132,7 @@ if __name__ == "__main__":
mbox = mailbox.mbox(config["top_mbox_file"])
current_date = next_weekday(datetime.date.today(), config["default_weekday"])
next_date = next_weekday(current_date, config["default_weekday"])
next_date = current_date + datetime.timedelta(days=7)
last_date = last_weekday(current_date, config["default_weekday"])
time = datetime.time.fromisoformat(config["default_time"])