aboutsummaryrefslogtreecommitdiff
path: root/wiki-from-email.py
blob: a8b39e9409c993a8cf6e01ca0ecc5ec92e7f32d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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()