changeset 190:c2923efebfdc

whitelist of files that can have an xmp sidecar, sample external command for creating sidecar
author nadvornik
date Sun, 16 Mar 2008 14:11:22 +0000
parents deea9e11f1d4
children 19df9953a5d1
files src/editors.c src/exif-common.c
diffstat 2 files changed, 14 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/editors.c	Sun Mar 16 10:52:44 2008 +0000
+++ b/src/editors.c	Sun Mar 16 14:11:22 2008 +0000
@@ -60,7 +60,7 @@
 	N_("XV"), "xv %f",
 	N_("Xpaint"), "xpaint %f",
 	N_("UFraw"), "ufraw %{.cr2;.crw;.nef;.raw}p",
-	NULL, NULL,
+	N_("Add XMP sidecar"), "%vFILE=%{.cr2;.crw;.nef;.raw}p;XMP=`echo \"$FILE\"|sed -e 's|\\.[^.]*$|.xmp|'`; exiftool -tagsfromfile \"$FILE\" \"$XMP\"",
 	NULL, NULL,
 	NULL, NULL,
 	NULL, NULL,
--- a/src/exif-common.c	Sun Mar 16 10:52:44 2008 +0000
+++ b/src/exif-common.c	Sun Mar 16 14:11:22 2008 +0000
@@ -329,18 +329,22 @@
 
 ExifData *exif_read_fd(FileData *fd, gint parse_color_profile)
 {
-	GList *work = fd->sidecar_files;
+	GList *work = fd->parent ? fd->parent->sidecar_files : fd->sidecar_files;
 	gchar *sidecar_path = NULL;
-				
-	while(work)
+
+	if (strcasecmp(fd->extension, ".cr2") == 0 || // FIXME: list of formats that can have xmp sidecar, make it configurable
+	    strcasecmp(fd->extension, ".nef") == 0)
 		{
-		FileData *sfd = work->data;
-		work = work->next;
-		printf("sfd %s\n", sfd->path);
-		if (strcasecmp(sfd->extension, ".xmp") == 0)
+		while(work)
 			{
-			sidecar_path = sfd->path;
-			break;
+			FileData *sfd = work->data;
+			work = work->next;
+			printf("sfd %s\n", sfd->path);
+			if (strcasecmp(sfd->extension, ".xmp") == 0)
+				{
+				sidecar_path = sfd->path;
+				break;
+				}
 			}
 		}