You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
576 B
Python
28 lines
576 B
Python
#!/usr/bin/env python3
|
|
#
|
|
# Add a task to taskwarrior via email. Makes use of the taskw Python bindings.
|
|
#
|
|
# http://taskwarrior.org
|
|
# https://github.com/ralphbean/taskw
|
|
#
|
|
# See README for more info.
|
|
#
|
|
|
|
from taskw import TaskWarrior
|
|
import time
|
|
import email
|
|
import fileinput
|
|
|
|
msg_string = ""
|
|
for line in fileinput.input():
|
|
msg_string += line
|
|
|
|
msg = email.message_from_string(msg_string)
|
|
subject = email.header.make_header(email.header.decode_header(msg.get("Subject")))
|
|
|
|
tdesc = str(subject).strip()
|
|
tdue = str(int(time.time()))
|
|
|
|
w = TaskWarrior()
|
|
w.task_add(tdesc, due=tdue)
|