aboutsummaryrefslogtreecommitdiff
path: root/wiki-from-email.py
diff options
context:
space:
mode:
Diffstat (limited to 'wiki-from-email.py')
-rwxr-xr-xwiki-from-email.py19
1 files changed, 19 insertions, 0 deletions
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()