whitelist of files that can have an xmp sidecar, sample external command
authorVladimir Nadvornik <nadvornik@suse.cz>
Sun, 16 Mar 2008 14:11:22 +0000 (14:11 +0000)
committerVladimir Nadvornik <nadvornik@suse.cz>
Sun, 16 Mar 2008 14:11:22 +0000 (14:11 +0000)
for creating sidecar

src/editors.c
src/exif-common.c

index d3dc561..0d1939b 100644 (file)
@@ -60,7 +60,7 @@ static gchar *editor_slot_defaults[GQVIEW_EDITOR_SLOTS * 2] = {
        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,
index 15cd2ab..9087267 100644 (file)
@@ -329,18 +329,22 @@ gchar *exif_get_data_as_text(ExifData *exif, const gchar *key)
 
 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;
+                               }
                        }
                }