def export_today(t): items = t.filter('@working and not @done') for item in items: if item.has_tag('@working'): due_date = datetime.now() if item.has_tag('at'): hour_str, minutes_str = item.get_tag_param('at').split(':') due_date = due_date.replace(hour=int(hour_str), minute=int(minutes_str)) else: due_date = due_date.replace(hour=23, minute=59) create_reminder(item.text, item.parents_to_str(), due_date, 'Working', should_print=True)
def set_reminders(todolist): for item in todolist.filter('@remind +d'): if item.has_tag('@remind'): remind_date_str = item.get_tag_param('@remind') remind_date = datetime.strptime(remind_date_str, '%Y-%m-%d %H:%M') item.remove_tag('remind') create_reminder( item.title.text, item.sub_tasks.as_plain_text(indent=False) if item.sub_tasks else '', remind_date, ) item.tag('willremind', param=remind_date_str)
def set_reminders(todolist): for item in todolist.filter("@remind"): if item.has_tag("@remind"): remind_date_str = item.get_tag_param("@remind") at = item.get_tag_param("at") if item.has_tag("at") else "23:59" date_str = remind_date_str + " " + at remind_date = datetime.strptime(date_str, "%Y-%m-%d %H:%M") item.remove_tag("remind") item.remove_tag("at") create_reminder(item.title.text, PlainPrinter().pformat(item.sublist), remind_date) item.tag("willremind", param=date_str) print "REMINDER:", item.title.text, remind_date
def export_deadlines(t): due = t.filter('@due and not @done and not project ? onhold') for item in due: if item.has_tag('due'): param = item.get_tag_param('due') due_date = datetime.strptime(param, '%Y-%m-%d') if item.has_tag('at'): hour_str, minutes_str = item.get_tag_param('at').split(':') due_date = due_date.replace(hour=int(hour_str), minute=int(minutes_str)) else: due_date = due_date.replace(hour=23, minute=59) create_reminder(item.text, item.parents_to_str(), due_date, 'Deadlines', should_print=True)
def set_reminders(todolist): for item in todolist.filter('@remind +d'): if item.has_tag('@remind'): remind_date_str = item.get_tag_param('@remind') remind_date = datetime.strptime(remind_date_str, '%Y-%m-%d %H:%M') item.remove_tag('remind') create_reminder( item.title.text, item.sub_tasks.as_plain_text( indent=False) if item.sub_tasks else '', remind_date, ) item.tag('willremind', param=remind_date_str)
def export_contexts(t): items = t.filter('project ? Contexts') for item in items: if item.text.startswith('@ ') or item.text == '': continue create_reminder(item.text, item.parents_to_str(), reminders_list='Contexts', should_print=True)
def export_generic(t, query, tag, list_name): items = t.filter(query) for item in items: if tag: if item.has_tag(tag): create_reminder(item.text, item.parents_to_str(), reminders_list=list_name, should_print=True)