read ubmails at generation time

This commit is contained in:
2021-07-13 17:24:22 +02:00
parent 1b822b8251
commit 808182cd21
4 changed files with 3 additions and 7 deletions

View File

@@ -23,6 +23,7 @@ pre_tops:
post_tops:
- title: Unbeantwortete E-Mails
command: ./read_ubmails.py
protostub: '<intern>
{{top.body}}

View File

@@ -4,8 +4,6 @@ dest_file="$(realpath "$(dirname "$0")")/data/presentation_$(date +%Y-%m-%d).tex
echo Reading old protocols
./read_db.sh
echo Getting E-Mail
./read_ubmails.py
echo Generating
./generate.py --presentation >"$dest_file"

View File

@@ -4,7 +4,6 @@ echo Reading old protocols
./read_db.sh
echo Getting E-Mail
./read_topmails.py
./read_ubmails.py
echo Generating
./generate.py --proto > ~/fsmi/protokolle/$(date +%Y-%m-%d)

View File

@@ -12,8 +12,7 @@ import quopri
from pprint import pprint
from dateutil import parser
MAILDIR = "/home/yannik/mail/INBOX/"
OUTFILE = "data/ubemails.txt"
MAILDIR = "/home/yannik/mail/INBOX.FSMI/"
def decode_header(header):
decoded_header = email.header.decode_header(header)[0]
@@ -46,5 +45,4 @@ if __name__ == "__main__":
print("WARNING: Mail is not from today", file=sys.stderr)
payload = latest.get_payload(decode=True).decode("utf8").strip()
result = (payload.rpartition("\n--")[0].strip() if "\n--" in payload else payload)
with open(OUTFILE, "w") as f:
f.write(result+"\n")
print(result)