|
From: | Ian Barton |
Subject: | Re: [Orgmode] iPhone ----> org-mode |
Date: | Mon, 23 Mar 2009 13:47:21 +0000 |
User-agent: | Thunderbird 2.0.0.19 (X11/20090105) |
Pretty simple - it could be cleaner, and filenames and such are hardcoded, but it should be easy for anyone to fix it up or simply replace the filenames and formatting to their liking. It's simple ... but still feels like magic when I press one button on my iPhone in the car, and what I spoke is sitting in my gtd.org when I get to the office :) ... tarball of hack attached. Note that my awk is from OS X, should work on linux as well though (I first got it running on linux, but had to escape some / characters in a pattern match to get reqallxml.awk to work on my mac and haven't tested it again on linux).
Appended is a quick hack in Python that appends items from the rss feed to an org file. Tasks are give the guid property, which is used to identify which tasks have already been imported.
Requires Mark Pilgrim's feed parser (think this is already part of Python) and Charles Cave's orgnode.py. Note orgnode.py seems to have a bug, where it requires at least one entry in the file.
Ian.
#!/usr/bin/python import feedparser # Note the current version of orgnode.py # requires a file with at least one entry. import orgnode REQUALL_URL = 'Requall RSS feed url' ORG_FILE = 'todo.org' def write_task(task): logfile = open(ORG_FILE, 'a') str = "* TODO %s\n:PROPERTIES:\n:guid: %s\n:END:\n%s\n" % (task.title, task.guid, task.description) logfile.write(str) logfile.close() def load_org_file(): """ Create a list of org objects. """ nodelist = orgnode.makelist(ORG_FILE) return nodelist # Open and parse the rss feed. d = feedparser.parse(REQUALL_URL) print d.feed.title for entry in d['entries']: nodelist = load_org_file() guids = [] # build a list of all the guids in the org file. for node in nodelist: guids.append(node.Property('guid')) # Only add entries for guids that are not already in the file. if entry.guid in guids: print "Entry skipped." else: write_task(entry) print entry.title print entry.category print entry.description
[Prev in Thread] | Current Thread | [Next in Thread] |