jensb / iphoto2xmp

Export an Apple iPhoto image library to a new directory (using hardlinks) with all metadata saved in XMP sidecar files.
GNU General Public License v3.0
34 stars 9 forks source link

postmortem sql issue due to single quote character #4

Closed erkcan closed 8 years ago

erkcan commented 8 years ago

Excellent, I seem to have managed to get my library ported into digiKam.

I now face a minor issue with the postmortem instructions. If the various event data or metadata etc contain single quote characters, the SQL code produced by iphoto2xmp is broken. Let me give an example:

UPDATE Albums SET date='2007-12-16', icon=(SELECT i.id FROM Images i LEFT JOIN Albums a ON i.album=a.id
      LEFT JOIN ImageComments c ON c.imageid=i.id WHERE c.comment='Photo 4' AND a.relativePath LIKE '%/Erkcan's book' LIMIT 1) WHERE relativePath LIKE '%/Erkcan's book';

Could it be possible to check the metadata strings for these characters and escape them while preparing the SQL commands?

jensb commented 8 years ago

Oops. OS X in German uses typographic quote characters (and others) by default so this was never an issue for me. Should be fixed. Please double check for missing images (in Digikam) after the export. Thank you!

erkcan commented 8 years ago

Thanks, it works now. I also checked for missing images in digikam and found none. For those who might read this in the future, here is the "crude" way I used to make sure no original photos were missing at all:

In my iphoto library directory, I executed: find . | egrep -i '^\./Masters.*\.jpe?g$' | awk -F/ '{print $NF}' | sort > /tmp/tt2

In my new digikam album root folder, I executed: find . | egrep -i '\.jpe?g$' | awk -F/ '{print $NF}' | sort > /tmp/tt1

First of file tt1 had more lines than tt2 and secondly when I diff'ed the two files the only differences were the new files whose names included the suffix "_v1.jpg" etc.