From 358ea2d32be88428df0c2739990a117132e98410 Mon Sep 17 00:00:00 2001 From: Mark Powers Date: Tue, 27 Oct 2020 20:11:18 -0500 Subject: Add multiple queries to email utils, add wiki from email. --- wiki-from-email.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 wiki-from-email.py (limited to 'wiki-from-email.py') diff --git a/wiki-from-email.py b/wiki-from-email.py new file mode 100755 index 0000000..a8b39e9 --- /dev/null +++ b/wiki-from-email.py @@ -0,0 +1,19 @@ +#!/usr/bin/python3 + +import email_helper +import datetime +import subprocess +from config import config + +def get_wiki_emails(): + bodies = email_helper.filter_unread("subject", "TODAY", "body date") + for b in bodies: + d = datetime.datetime.strptime(b["date"], "%a, %d %b %Y %H:%M:%S %z") + title = d.strftime("%B %-d") + path = d.strftime("%Y/%b/%d").lower() + exe = "/home/mark/projects/wikijscmd/main.py" + args = [exe, "create", path, title, b["body"]] + print(args) + subprocess.run(args) + +get_wiki_emails() -- cgit v1.2.3