I'm starting to add photos to my timeline project - they really add to the emotional power of it for me. I wanted to make a new timeline of big trips I've taken - I already have a lot of photo galleries online so it was a matter of harvesting from there, using the galleries both for the images and just as a reminder of what trips I've taken, and when.
I stumbled onto having "one folder per trip", each name "yyyy mm tripname" and each containing a single jpeg. And my JSON format for each entry is something like
{name:'boston', from:{y:1991 , m:03 }, to:{y:1991, m:03},
img:'trips/1991 03 boston/043_560.1991 jazz band in boston.jpg'},
so from the shell, I ran
find . | grep -i jp | sort
which was good enough to get me the list of jpegs in a format like
./1991 03 boston/043_560.1991 jazz band in boston.jpg
and then at regexcellent the matcher was
^\.\/(\d\d\d\d) (\d\d) (.*)\/(.*)$
and the output pattern was
{name:'$3', from:{y:$1 , m:$2 }, to:{y:$1, m:$2}, img:'trips/$1 $2 $3/$4'},
A little comma cleanup and I was done!
To quote Douglas Adams, "[I] am rarely happier than when spending an entire day programming my computer to perform automatically a task that would otherwise take me a good ten seconds to do by hand."
No comments:
Post a Comment