shell script - iPhoto - "Caption" & "Filename" - rename to desktop

ateale

Registered
Hey guys,

I am in the process of finding a way to make a copy of a file in my iPhoto library to a folder on my Desktop, giving it the name i gave it in iPhoto (its Caption).

I get the AlbumData.xml document in ~/Pictures/iPhoto\ Library/
I make a copy of it (in case i ruin it) to ~/Desktop/test/.

I open that file with Property List Editor (xcode tools i think)
I save the file as an ascii file (with .txt extension)

I noticed that the file is full of something i am guessing is STRINGS? or Objects? not sure - but a pair of {} filled with all the info of each of my photos and videos in my iPhoto library.

From here i do the following commands to return the OriginalPath(for movies) and the Caption - for this file: ~/Desktop/test/AlbumData.txt

grep 'OriginalPath\ = .*;' ~/Desktop/test/AlbumData.txt | sed -e 's/OriginalPath\ =\ "//' | sed -e 's/";//' | sed -e 's/ //'
grep 'Caption\ = .*;' ~/Desktop/test/AlbumData.txt | sed -e 's/Caption = //' | sed -e 's/";//' | sed -e 's/"//' | sed -e 's/ //'

What i want to do is something like:
For each instance of "OriginalPath", copy that to ~/Desktop/test/
and give it the "Caption" as its filename

so;
/Pictures/iPhoto Library/2005/06/09/DSCF0774.AVI
will be copied to ~/Desktop/test/
and be renamed to its caption - something like "Holiday_Rome_001.AVI"
and this loops, i guess, for each occurence of "OrignalPath"

anyone got any pointers? Does it make any sense?

Thanks guys!
Adam
ateale@mac.com
 
If you have 10.4, you could do most of this using Automator quite easily. Take a look at some of the iPhoto actions and play around.
 
Back
Top