Skip to content

Commit

Permalink
Merge pull request darktable-org#10175 from aurelienpierre/improve-cr…
Browse files Browse the repository at this point in the history
…awler

Improve crawler
  • Loading branch information
TurboGit authored Oct 11, 2021
2 parents 13dd76c + 01a9a2a commit 6b53b23
Show file tree
Hide file tree
Showing 4 changed files with 417 additions and 118 deletions.
12 changes: 6 additions & 6 deletions src/common/exif.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1177,7 +1177,7 @@ static bool _exif_decode_exif_data(dt_image_t *img, Exiv2::ExifData &exifData)
Exiv2::ExifData::const_iterator cm1_pos = exifData.findKey(Exiv2::ExifKey("Exif.Image.ColorMatrix1"));
if((illu[0] != DT_LS_Unknown) && (cm1_pos != exifData.end()) && (cm1_pos->count() == 9))
{
for(int i = 0; i < 9; i++) colmatrix[0][i] = cm1_pos->toFloat(i);
for(int i = 0; i < 9; i++) colmatrix[0][i] = cm1_pos->toFloat(i);
}
else
illu[0] = DT_LS_Unknown;
Expand All @@ -1186,7 +1186,7 @@ static bool _exif_decode_exif_data(dt_image_t *img, Exiv2::ExifData &exifData)
Exiv2::ExifData::const_iterator cm2_pos = exifData.findKey(Exiv2::ExifKey("Exif.Image.ColorMatrix2"));
if((illu[1] != DT_LS_Unknown) && (cm2_pos != exifData.end()) && (cm2_pos->count() == 9))
{
for(int i = 0; i < 9; i++) colmatrix[1][i] = cm2_pos->toFloat(i);
for(int i = 0; i < 9; i++) colmatrix[1][i] = cm2_pos->toFloat(i);
}
else
illu[1] = DT_LS_Unknown;
Expand All @@ -1196,7 +1196,7 @@ static bool _exif_decode_exif_data(dt_image_t *img, Exiv2::ExifData &exifData)
Exiv2::ExifData::const_iterator cm3_pos = exifData.findKey(Exiv2::ExifKey("Exif.Image.ColorMatrix3"));
if((illu[2] != DT_LS_Unknown) && (cm3_pos != exifData.end()) && (cm3_pos->count() == 9))
{
for(int i = 0; i < 9; i++) colmatrix[2][i] = cm3_pos->toFloat(i);
for(int i = 0; i < 9; i++) colmatrix[2][i] = cm3_pos->toFloat(i);
}
else
illu[2] = DT_LS_Unknown;
Expand All @@ -1209,7 +1209,7 @@ static bool _exif_decode_exif_data(dt_image_t *img, Exiv2::ExifData &exifData)
// otherwise we take the one closest >= D65
for(int i = 0; i < 3; i++)
{
if((illu[i] != DT_LS_Unknown) && (_illu_to_temp(illu[i]) > sel_temp) && (sel_temp < D65temp))
if((illu[i] != DT_LS_Unknown) && (_illu_to_temp(illu[i]) > sel_temp) && (sel_temp < D65temp))
{
sel_illu = i;
sel_temp = _illu_to_temp(illu[i]);
Expand Down Expand Up @@ -1259,7 +1259,7 @@ static bool _exif_decode_exif_data(dt_image_t *img, Exiv2::ExifData &exifData)
case DT_LS_D65:
for(int i = 0; i < 9; i++) img->d65_color_matrix[i] = colmatrix[sel_illu][i];
break;

default:
fprintf(stderr,"[exif] did not find a proper dng correction matrix for illuminant %i\n", illu[sel_illu]);
break;
Expand Down Expand Up @@ -4175,8 +4175,8 @@ int dt_exif_xmp_write(const int imgid, const char *filename)
{
fprintf(stderr, "cannot write xmp file '%s': '%s'\n", filename, strerror(errno));
dt_control_log(_("cannot write xmp file '%s': '%s'"), filename, strerror(errno));
return -1;
}

}

return 0;
Expand Down
11 changes: 7 additions & 4 deletions src/common/image.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ dt_imageio_write_xmp_t dt_image_get_xmp_mode()
{
res = DT_WRITE_XMP_ALWAYS;
dt_conf_set_string("write_sidecar_files", "on import");
}
}
return res;
}

Expand Down Expand Up @@ -1412,7 +1412,7 @@ static int _image_read_duplicates(const uint32_t id, const char *filename, const
static uint32_t _image_import_internal(const int32_t film_id, const char *filename, gboolean override_ignore_jpegs,
gboolean lua_locking, gboolean raise_signals)
{
const dt_imageio_write_xmp_t xmp_mode = dt_image_get_xmp_mode();
const dt_imageio_write_xmp_t xmp_mode = dt_image_get_xmp_mode();
char *normalized_filename = dt_util_normalize_path(filename);
if(!normalized_filename || !dt_util_test_image_file(normalized_filename))
{
Expand Down Expand Up @@ -2420,7 +2420,7 @@ int dt_image_local_copy_reset(const int32_t imgid)
// xmp stuff
// *******************************************************

void dt_image_write_sidecar_file(const int32_t imgid)
int dt_image_write_sidecar_file(const int32_t imgid)
{
// TODO: compute hash and don't write if not needed!
// write .xmp file
Expand All @@ -2439,7 +2439,7 @@ void dt_image_write_sidecar_file(const int32_t imgid)
dt_image_full_path(imgid, filename, sizeof(filename), &from_cache);

// nothing to do, the original is not accessible and there is no local copy
if(!from_cache) return;
if(!from_cache) return 1;
}

dt_image_path_append_version(imgid, filename, sizeof(filename));
Expand All @@ -2457,8 +2457,11 @@ void dt_image_write_sidecar_file(const int32_t imgid)
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, imgid);
sqlite3_step(stmt);
sqlite3_finalize(stmt);
return 0;
}
}

return 1; // error : nothing written
}

void dt_image_synch_xmps(const GList *img)
Expand Down
2 changes: 1 addition & 1 deletion src/common/image.h
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ gboolean dt_image_safe_remove(const int32_t imgid);
/* try to sync .xmp for all local copies */
void dt_image_local_copy_synch(void);
// xmp functions:
void dt_image_write_sidecar_file(const int32_t imgid);
int dt_image_write_sidecar_file(const int32_t imgid);
void dt_image_synch_xmp(const int selected);
void dt_image_synch_xmps(const GList *img);
void dt_image_synch_all_xmp(const gchar *pathname);
Expand Down
Loading

0 comments on commit 6b53b23

Please sign in to comment.