summaryrefslogtreecommitdiff
path: root/review.py
diff options
context:
space:
mode:
Diffstat (limited to 'review.py')
-rwxr-xr-xreview.py51
1 files changed, 51 insertions, 0 deletions
diff --git a/review.py b/review.py
new file mode 100755
index 0000000..a17cccc
--- /dev/null
+++ b/review.py
@@ -0,0 +1,51 @@
+#!/usr/bin/python
+import os
+from os.path import abspath, dirname
+from operator import itemgetter
+
+"""
+ parse my gtd folder
+ pull out files that start with the project name which is in []
+ loop through and grab the project and then all the associated
+ tasks (rest of the file name)
+ print the results out to a file called @project.txt
+"""
+# assuming that this script is in ~/bin this will work:
+BASE_DIR = abspath(dirname(dirname(__file__))) + '/'
+project_list = []
+inprogress = False
+for root, dirnames, filenames in os.walk('%sgtd' % (BASE_DIR)):
+ for f in filenames:
+ if not f.startswith('@') and not f.startswith('.') and not f.startswith('Notes & Settings') and not f.startswith('projx') and not f.startswith("errands"):
+
+ name = f[f.find("[") + 1:f.find("]")]
+ task = f[f.find("]") + 2:-4]
+
+ if f.find("]") > 5:
+ inprogress = True
+ task = "* " + task
+ with open('%sgtd/%s' % (BASE_DIR, f), "r") as fl:
+ for line in fl:
+ for part in line.split():
+ if "@waiting" in part:
+ task = task + " -- " + line.rstrip()
+ project_list.append({
+ "file": f,
+ "name": name,
+ "task": task,
+ "inprogress": inprogress,
+ })
+ break
+
+newlist = sorted(project_list, key=itemgetter('name', 'task'))
+
+projects_file = open("/Users/sng/gtd/@projects.txt", 'w')
+l_name = ''
+
+for p in newlist:
+ if l_name == p['name']:
+ print >> projects_file, "\t" + p['task']
+ else:
+ print >> projects_file, "\n" + p['name']
+ print >> projects_file, "\t" + p['task']
+ l_name = p['name']