Re: how to copy all versions of the photo



Lorenzo Milesi wrote:
actually, it's not possible.

----- "Antti Ahonen"<aahonen gmail com>  ha scritto:

Hi.
I have one problem, I was wondering if somebody could help me:

I have my raw+jpg files merged together as versions. Now I need to
copy large amount of photos with specific tag to an external drive,
how can I do it iso I get all versions of every photo there?

-thanks, Antti Ahonen

You could write a script to do this. Use sqlite to query the database for the URI's for those photo's and copy those URI's to the external drive.

Something like the attached script maybe? It produces a list of all photos with the given TAG:

	sh move_photos TAG

You could feed that list to a copy command:

	sh move_photos TAG|while read photo; do cp "$photo" /path; done

You need to use 'read' and quotes around the parameters because f-spot unfortunately uses spaces in filenames, a sin if you ask me.

Look at the script before you use it. I just hacked it up so who knows what it does? I think I know but you should know as well before you allow it on your system.

Cheers//Frank
#!/bin/sh
dba="sqlite3 /home/${USER}/.config/f-spot/photos.db"
tagname="$1"

urldecode () {
	perl -MURI::Escape -lne 'print uri_unescape($_)'
}

list () {
	$dba "SELECT photos.base_uri||''||photos.filename as name FROM photos,photo_tags,tags WHERE photos.id=photo_tags.photo_id AND photo_tags.tag_id=tags.id AND tags.name='${tagname}' AND default_version_id='1' UNION SELECT photo_versions.base_uri||''||photo_versions.filename as name FROM photo_versions,photos,photo_tags,tags WHERE photos.id=photo_versions.photo_id AND photos.id=photo_tags.photo_id AND photo_tags.tag_id=tags.id AND tags.name='${tagname}' ORDER BY 1"|sed -e 's#file://##'|urldecode
}

list


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]