public
Last active

Import to Day One Journal app from Racounter Application Data Extract

  • Download Gist
racounter2dayone.sh
Shell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#!/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;")

somehow some entries are doubled after importing.

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.