read TOP text from file
This commit is contained in:
10
generate.py
10
generate.py
@@ -5,7 +5,7 @@ import email.header
|
|||||||
import email.utils
|
import email.utils
|
||||||
import yaml
|
import yaml
|
||||||
import datetime
|
import datetime
|
||||||
import sys
|
import sys, os
|
||||||
import pypandoc
|
import pypandoc
|
||||||
import argparse
|
import argparse
|
||||||
import quopri
|
import quopri
|
||||||
@@ -91,6 +91,12 @@ def conf2top(top):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
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)
|
return Top(top["title"], sender, body, protostub)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
@@ -126,7 +132,7 @@ if __name__ == "__main__":
|
|||||||
mbox = mailbox.mbox(config["top_mbox_file"])
|
mbox = mailbox.mbox(config["top_mbox_file"])
|
||||||
|
|
||||||
current_date = next_weekday(datetime.date.today(), config["default_weekday"])
|
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"])
|
last_date = last_weekday(current_date, config["default_weekday"])
|
||||||
|
|
||||||
time = datetime.time.fromisoformat(config["default_time"])
|
time = datetime.time.fromisoformat(config["default_time"])
|
||||||
|
|||||||
Reference in New Issue
Block a user