On Mon, 2009-07-20 at 07:53 -0700, Bill Moseley wrote:
>
> I did something similar with a Perl script. It was quite easy to do.
Yeah. I've got most of a bash script to do it.
> I don't have that script around, but I still use my own script to
> import photos.
Interesting. Does it get the dates right? :-) What a mess this date
behaviour is in f-spot.
> I'd probably scan the file system for photos that are not in the
> correct place, attempt to lookup in the f-spot database, and then
> either update or insert after moving the file.
Well, I think the database is the place to start:
echo "select * from photos;" | sqlite3 photos.db |
( IFS=\|; while read id time uri description version_id rating md5_sum; do
if [[ $uri != file:///data/photos/200?/* ]]; then
path=${uri##file://}
echo "mv \"$path\" /data/photos/$(date -d $(ctime $time) +%Y/%m/%d) # $id"
# need to update database. can I use an sqlite3 command here given that
# I already have one with the database open for reading?
fi
done; )
Of course, rather than just echoing it, I need to do the actual "mv" as
well as I need to update the database to the new location.
Is it safe to have one sqlite3 instance reading from the database while
another is updating it?
Cheers,
b.
Attachment:
signature.asc
Description: This is a digitally signed message part