Last active
August 29, 2015 14:18
-
-
Save filex/924de68d55e616a167ff to your computer and use it in GitHub Desktop.
python script to convert OmniFocus tasklists with notes to an OPML document that OmniOutliner can read.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/python | |
import csv | |
import sys | |
from xml.sax import saxutils | |
tasklist = csv.DictReader(sys.stdin, delimiter=',', quotechar='"') | |
depth = 0 | |
last_depth = 0 | |
lines = 0; | |
for row in tasklist: | |
if row['Type'] in ['Action', 'Project']: | |
depth = row['Task ID'].count('.') | |
if lines == 0: | |
print '<opml><body>' | |
else: | |
for i in range(last_depth - depth +1): print '</outline>' | |
print '<outline text=%s _note=%s>' % (saxutils.quoteattr(row['Name']), saxutils.quoteattr(row['Notes'])) | |
last_depth = depth | |
lines += 1 | |
if lines == 0: | |
print >> sys.stderr, "no rows found: %i" % lines | |
sys.exit(1) | |
else: | |
for i in range(depth + 1): print '</outline>' | |
print '</body></opml>' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The script uses OmniFocus CSV export: