-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 11/19/2015 02:39 PM, Šarūnas Burdulis wrote:
> Hello,
> 
> Would it be possible to make camera model variable, e.g. $(EXIF_MODEL),
> available in lighttable > export > storage options?

Hello, developers,
would someone care to take a look at the attached patch? It ads
$(EXIF_MODEL) to recognized variables in the export to files on disk
file naming field. I used darktable-org/darktable master branch to start
with.

Sorry if this is not how it should be done. Too many years have passed
since I have written anything in C, and this is the first time I looked
at the darktable source.

Best,
- -- 
Šarūnas Burdulis
http://math.dartmouth.edu/~sarunas
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iEYEARECAAYFAlZPiJ4ACgkQVVkpJ1MUn+b9YQCfXcpKSjzfHI80CZCshUqLEGKZ
nZMAn3Ua5s8RK8cJwYmjch842Su8r+Qj
=C/dd
-----END PGP SIGNATURE-----

___________________________________________________________________________
darktable developer mailing list
to unsubscribe send a mail to darktable-dev+unsubscr...@lists.darktable.org
>From 915c74abcfe308fac32e09bb0509bbd2d979c71f Mon Sep 17 00:00:00 2001
From: sarunasb <saru...@mail.saabnet.com>
Date: Fri, 20 Nov 2015 15:39:09 -0500
Subject: [PATCH] Ads $(EXIF_MODEL) variable to the list of recognized
 variables while exporting to files on disk.

---
 src/common/variables.c | 4 ++++
 src/gui/gtkentry.c     | 1 +
 2 files changed, 5 insertions(+)

diff --git a/src/common/variables.c b/src/common/variables.c
index 62aa3ef..423ce5e 100644
--- a/src/common/variables.c
+++ b/src/common/variables.c
@@ -117,6 +117,7 @@ gboolean _variable_get_value(dt_variables_params_t *params, gchar *variable, gch
   /* image exif time */
   gboolean have_exif_tm = FALSE;
   int exif_iso = 100;
+  char exif_model[64];
   int version = 0;
   int stars = 0;
   struct tm exif_tm = { 0 };
@@ -131,6 +132,7 @@ gboolean _variable_get_value(dt_variables_params_t *params, gchar *variable, gch
       have_exif_tm = TRUE;
     }
     exif_iso = img->exif_iso;
+    g_strlcpy(exif_model, img->exif_model, sizeof(exif_model));
     version = img->version;
     stars = (img->flags & 0x7);
     if(stars == 6) stars = -1;
@@ -165,6 +167,8 @@ gboolean _variable_get_value(dt_variables_params_t *params, gchar *variable, gch
     snprintf(value, value_len, "%.2d", (have_exif_tm ? exif_tm.tm_sec : tim->tm_sec));
   else if(g_strcmp0(variable, "$(EXIF_ISO)") == 0 && (got_value = TRUE))
     snprintf(value, value_len, "%d", exif_iso);
+  else if(g_strcmp0(variable, "$(EXIF_MODEL)") == 0 && (got_value = TRUE))
+    snprintf(value, value_len, "%s", exif_model);
   else if(g_strcmp0(variable, "$(ID)") == 0 && (got_value = TRUE))
     snprintf(value, value_len, "%d", params->imgid);
   else if(g_strcmp0(variable, "$(VERSION)") == 0 && (got_value = TRUE))
diff --git a/src/gui/gtkentry.c b/src/gui/gtkentry.c
index bee97d8..fa05d9a 100644
--- a/src/gui/gtkentry.c
+++ b/src/gui/gtkentry.c
@@ -203,6 +203,7 @@ const dt_gtkentry_completion_spec *dt_gtkentry_get_default_path_compl_list()
           { "EXIF_MINUTE", N_("$(EXIF_MINUTE) - EXIF minute") },
           { "EXIF_SECOND", N_("$(EXIF_SECOND) - EXIF second") },
           { "EXIF_ISO", N_("$(EXIF_ISO) - ISO value") },
+          { "EXIF_MODEL", N_("$(EXIF_MODEL) - camera model") },
           { "STARS", N_("$(STARS) - star rating") },
           { "LABELS", N_("$(LABELS) - colorlabels") },
           { "PICTURES_FOLDER", N_("$(PICTURES_FOLDER) - pictures folder") },
-- 
2.5.0

Reply via email to