Skip to content

Commit 296eb87

Browse files
victoryforceTurboGit
authored andcommitted
Fix flash firing detection
1 parent 17f5715 commit 296eb87

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/common/variables.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,16 @@ typedef struct dt_variables_data_t
106106

107107
static char *_expand_source(dt_variables_params_t *params, char **source, char extra_stop);
108108

109+
static gboolean _is_flash_fired(const dt_image_t *img)
110+
{
111+
if(g_strrstr(img->exif_flash, "did not fire"))
112+
return FALSE;
113+
if(img->exif_flash[0] == 'N') // "No", that is no flash function present
114+
return FALSE;
115+
else
116+
return TRUE; // all other strings mean that the flash fired
117+
}
118+
109119
// gather some data that might be used for variable expansion
110120
static void _init_expansion(dt_variables_params_t *params, gboolean iterate)
111121
{
@@ -180,8 +190,8 @@ static void _init_expansion(dt_variables_params_t *params, gboolean iterate)
180190
params->data->longitude = img->geoloc.longitude;
181191
params->data->latitude = img->geoloc.latitude;
182192
params->data->elevation = img->geoloc.elevation;
183-
params->data->exif_flash_icon = img->exif_flash[0] == 'Y' ? "⚡" : "";
184-
params->data->exif_flash = img->exif_flash[0] == 'Y' ? _("yes") : (img->exif_flash[0] == 'N' ? _("no") : _("n/a"));
193+
params->data->exif_flash_icon = _is_flash_fired(img) ? "⚡" : "";
194+
params->data->exif_flash = _is_flash_fired(img) ? _("yes") : _("no");
185195
params->data->exif_exposure_program = img->exif_exposure_program;
186196
params->data->exif_metering_mode = img->exif_metering_mode;
187197
params->data->exif_whitebalance = img->exif_whitebalance;

0 commit comments

Comments
 (0)