I've been updating the script to try and add enough data to the SqlLite databases. As soon as you save a photo from safari the following data is entered:
sqlite> select * from Photo;
primaryKey|type|title|captureTime|width|height|userRating|flagged|thumbnailIndex|orientation|directory|filename|duration|recordModDate
43|0|IMG_0037|320336214.0|640|427|0|0|0|1|DCIM/100APPLE|IMG_0037.JPG|0.0|320336214.933387
sqlite> select * from PhotoExtras;
primaryKey|foreignKey|identifier|sequence|value
142|43|1|-1|DCIM/100APPLE
143|43|2|-1|IMG_0037.JPG
144|43|3|-1|76616
145|43|6|-1|
streamtyped???@???NSMutableDictionary
146|43|7|-1|286
147|43|8|-1|
streamtyped???@???NSValue
148|43|9|-1|8252
149|43|10|-1|1
150|43|13|-1|0
The Photo table data seems quite simple although I'm currently assuming captureTime is not relevant. The PhotoExtras stuff is a bit more involved and seems necessary as my current script, which needs image magicks identify command, is not working.
identifier 1 is directory name
identifier 2 is jpg name
identifier 3 is file size in bytes
If anyone can help with the others..
The script as it stands is below:
#!/bin/bash
rootPath="$HOME/Library/Application Support/iPhone Simulator/4.2/Media"
relPath="100APPLE"
simPath="$rootPath/DCIM/$relPath"
sqlDB="$rootPath/PhotoData/Photos.sqlite"
if [ -z "$1" ]; then
echo usage: $0 "<folder>"
exit 1
fi
if [ ! -d "$simPath" ]; then
mkdir -p "$simPath"
fi
echo "Finding pictures..."
# Find out which incremential number we're at currently.
index=1
for i in `ls $1/*.{JPG,jpg,png,gif,bmp} 2>/dev/null`; do
echo "considering $i..."
while [ -f "$simPath/`printf IMG_%04d.JPG $index`" ]; do
let index=$index+1
done
imgName=`printf IMG_%04d $index`
jpgName=`printf IMG_%04d.JPG $index`
thmName=`printf IMG_%04d.THM $index`
jpgWidth=`identify -format %w $i`
jpgHeight=`identify -format %h $i`
echo $i "->" $simPath/$jpgName
jpgSize=`stat -f %z $i`
jpgDir="DCIM/100APPLE"
sips -s format jpeg $i --out "$simPath/$jpgName" > /dev/null 2> /dev/null || continue
sqlite3 "$sqlDB" "insert into Photo (title,width,height,directory,filename) values ('$imgName',$jpgWidth,$jpgHeight,'$jpgDir','$jpgName')"
foreignKey=`sqlite3 "$sqlDB" "select primaryKey from Photo where title='$imgName'"`
sqlite3 "$sqlDB" "insert into PhotoExtras (foreignKey,identifier,value) values ($foreignKey,1,'$jpgDir'); \
insert into PhotoExtras (foreignKey,identifier,value) values ($foreignKey,2,'$jpgName'); \
insert into PhotoExtras (foreignKey,identifier,value) values ($foreignKey,3,$jpgSize);"
let index=$index+1
done
I'll edit if I get further, the next stage is identifying what the various .ithmb files contain. Hopefully some sort of stack of jpg thumbnails.