Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Import to Day One Journal app from Racounter Application Data Extract
#!/bin/bash
# Uses Day One cli [http://dayoneapp.com/tools/cli-man] and sqlite3
# Expects extract from iPhone backup made by JuicePhone [http://www.addpod.com/juicephone], folder with a device name should be passed as an argument
[ -z "$1" ] && echo "$0: Usage: $0 Device-Name-Exctracted-Folder" && exit 0
[ ! -d "$1" ] && echo "$0: $1 is not a directory" && exit 0
[ ! -e "$1/Application Data/Raconteur/Documents/Entries.sqlite" ] && echo "$0: $1 doesn't contain Racounter app extract." && exit 0
RT="$1"
while IFS=$'\t' read DT PC FV TX; do
(( ! ${PC} )) && unset PC;
(( ! ${FV} )) && unset FV;
echo -e ${TX} | dayone -d="${DT}" ${FV:+-s=true} ${PC:+-p="${RT}/Application Data/Raconteur/Documents/Pictures/${DT}.jpg"} new;
done < <(sqlite3 -list -noheader -separator $'\t' "${RT}/Application Data/Raconteur/Documents/Entries.sqlite" "select date('2001-01-01', ZFORDATE || ' seconds'), ZHASPICTURE, ZISFAVORITE, replace(ZTEXT,X'0A','\\\n') from ZENTRY;")
Owner

PawelWitan commented Sep 1, 2012

somehow some entries are doubled after importing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment