Trunk Notes sync between iPhone and Mac/PC
Don’t get too excited, I am not announcing a polished application for Mac/PC to sync with Trunk Notes on your iPhone. Also a quick warning that this blog post is fairly technical. Feel free to stop reading at any time!
Unfortunately as a part time iPhone developer I haven’t had as much time as I would like to fully develop such a program. My intention to rewrite in Java has met the stumbling block of not having written any Java for eight years and a lack of time to refresh my knowledge of the language - a poor excuse I know! There are lots of features still to add to Trunk Notes and I am working on the next version at the moment. It’s also about time I developed a new app - maybe something not quite as geeky ;o)
I did develop a sync client in Python. It works pretty well, for me anyway. It works on Mac OS X 10.5 and above (although it should be trivial to get it working under Windows or Linux). At the moment though it has a few issues with non-ASCII characters in note titles and has to be run from the command line. However I have been using it now for months in conjunction with Notational Velocity. Since it syncs Trunk Notes on the iPhone with a local folder on your computer it could be used with many different programs.
I have just been asked a question on Twitter, and the forum, about sync between Trunk Notes and VoodooPad. Since I don’t have time at the moment to develop such a solution I thought a blog post with a few basic details about the current sync solution might spur someone else to do just that!
The Trunk Notes API for syncing is very simple. Almost too simple (and a little naive!) There is no JSON involved, XML or any other buzzwords. Just some simple plain text HTTP POST requests.
There are just four functions which the API supports:
notes_list - grabs a list of all Trunk Notes wiki entries. The list of notes is just a series of lines containing a notes timestamp and title. The timestamps are UNIX style timestamps, in seconds since 1/1/1970. For example:
1267228800:ShoppingList
1267228903:CurrentProjectsget_note - given a title this retrieves a note from the iPhone
- update_note - the contents of the note (including header metadata in the same format as provided in a backup) and the name of the note
- remove_note - the title of the note to delete
The client must of course also authorise its connection to the iPhone using the Wi-Fi Share username and password.
The Python client is a good starting point for anyone wanting to know more about how this works. It is available for download under the BSD licence, which basically says that you can do anything you want with the code except remove the copyright notice at the top of the file.
So if any developers out there are also fans of Trunk Notes and are itching to do something like sync with VoodooPad then feel free to have a go!
For more details on the example Python sync client, and the source code see this forum post
