#!/usr/local/bin/python # print query of tasks to be added to reminders Now list import sys #import time import re import todoflow if len(sys.argv) > 1: applescriptIndex = int(sys.argv[-1]) #curDate = time.strftime("%Y-%m-%d") taskfilename = '/Users/eck/Dropbox/Notes/todo.taskpaper' todos = todoflow.from_path(taskfilename) reminderItems = [] #for item in todos.filter('((@today or @focus or @overdue or @next or @due <= ' + curDate + ' ) and not @done)+d'): for item in todos.filter('@today and not @done'): if todoflow.textutils.is_project(str(item)): curProject = item if todoflow.textutils.is_task(str(item)): reminderItems.append(str(curProject).capitalize() + re.sub(' @today','',str(item)[1:])) if len(sys.argv) > 1: print reminderItems[applescriptIndex] else: print len(reminderItems)
def has_project(project, filename): todos = todoflow.from_path(filename) for item in todos.search('type = "project"'): if project in str(item): return 1 return 0