#!/bin/sh # written by: jetxee # hosted at: http://code.google.com/p/tomboy2tiddly # license: New BSD # for all files given while [ $# -ge 1 ] ; do f=$1 ; shift ; # reading data from tomboy note file TITLE=$(xmlstarlet sel -N tb=http://beatniksoftware.com/tomboy \ -t -v '/tb:note/tb:title' ${f} | \ sed 's#"#\"#g' ) ; DATE=$(xmlstarlet sel -N tb=http://beatniksoftware.com/tomboy \ -t -v '/tb:note/tb:last-change-date' ${f} ) ; # convert tomboy date string to tiddly date string TDATE=$(python -c ' from time import strptime, strftime, mktime, gmtime from re import sub import sys tb_date=sys.argv[1] t=strptime(sub("\..*","",tb_date),"%Y-%m-%dT%H:%M:%S") adj=map(lambda x:int(x),sub(".*([\+-])","\\1",tb_date).split(":")) lt=mktime(t)+60*adj[0]+adj[1] print strftime("%Y%m%d%H%M",gmtime(lt)) ' ${DATE} ) # current date in tiddly format MDATE=$(python -c 'from time import *; print strftime("%Y%m%d%H%M",localtime());') # print the note as it would look in tiddly XHTML, tag as from_tomboy cat <
$(cat ${f} | \
	sed 's##\[\[#g; s##\]\]#g;' | \
	xmlstarlet sel -N tb=http://beatniksoftware.com/tomboy \
		-t -v '/tb:note/tb:text' | sed 's#"#\"#g' )
END done