Skip to content

Instantly share code, notes, and snippets.

@chihchun
Created January 6, 2011 16:30
Show Gist options
  • Save chihchun/768122 to your computer and use it in GitHub Desktop.
Save chihchun/768122 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
# -*- coding: utf-8 -*-
from xml.etree import ElementTree
import dbus
import urllib
import sys
def main(argv=sys.argv):
gtg = dbus.SessionBus().get_object('org.GTG', '/org/GTG')
tasks = gtg.get_tasks()
search_string = argv[1].lower().decode('utf-8')
for task in tasks:
if(task['text'].lower().find(search_string) != -1 or task['title'].lower().find(search_string) != -1):
print "[%s] %s (%s) %s" % (task['id'], task['title'], task['tags'], task['status'])
print "Enter task id to open dialog"
ret = sys.stdin.readline()
gtg.open_task_editor("%d@1" % int(ret))
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment