Comment 20 for bug 354264

Revision history for this message
Mary Gardiner (puzzlement) wrote :

I have a Python script that fixes up the mess. It shouldn't have any dependencies other than Python itself. I've only tested with Python 2.6, but I don't know of any reason 2.5 wouldn't work (before 2.5 the sqlite3 module won't be available).

Features:

1. Moves files to [target-dir]/YYYY/MM/DD for the date of the photograph itself, as is f-spot's current correct behaviour, creating these directories where necessary

2. Target dir need not be ~/Photos but can be arbitrary

3. Updates the photos and photo_versions tables in the f-spot database correctly (as far as I can tell anyway) both for original versions and modified versions.

----

Usage: fix-fspot.py [correct target directory] [files...]

Example usage:

python fix-fspot.py ~/Photos ~/img_0001.jpg ~/img_0002.jpg

Move ~/img_0001.jpg and ~/img_0002.jpg to the correct location under ~/Photos and updates the f-spot database appropriately.

In case of corruption, your original database will be copied to ~/.gnome2/f-spot/photos.db-[TIMESTAMP] each time this runs

----

My run of this was:

python fix-fspot.py ~/Photos ~/*.{cr2,jpg}

but of course you will want to construct your own command line.