Hi,

It seems Exiv2 is syncing it's lens names with ExifTool for some brands,
however, that does mean some will break lensfun matching (if fuzzy matching
is not used)...

http://dev.exiv2.org/projects/exiv2/repository/revisions/3004/diff/trunk/src/canonmn.cpp
http://dev.exiv2.org/projects/exiv2/repository/revisions/3003/diff/trunk/src/pentaxmn.cpp

Particularly these changes:

From: {  10, "Canon EF 50mm f/2.5 Macro"
}, // 0
To:     {  10, "Canon EF 50mm f/2.5 Macro or Sigma Lens"            }, // 0

So the " or Sigma Lens" part will make strict matching fail for Lensfun...

I don't really want us to go back to fuzzy matching, and the sensible thing
to do, seems to be to cut off anything past ' or ' before passing the
string to lensfun...

I attached some proof of concept code, I hope you guys can take a look to
see if I've done nothing too silly (introduced a memory leak etc :).

Regards,
Pascal de Bruijn
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

char *lens_sanatize(char *orig_lens)
{
  char *found_or = strstr(orig_lens, " or ");

  if (found_or)
  {
    size_t pos = (size_t)(found_or - orig_lens);

    char *new_lens = (char*) malloc(pos++);

    strncpy(new_lens, orig_lens, pos);
    new_lens[pos++] = '\0';

    return new_lens;
  }
  else
  {
    return orig_lens;
  }
}

int main(int argc, char *argv[])
{
   puts(lens_sanatize("Canon EF 100-300mm f/5.6L"));
   puts(lens_sanatize("Canon EF 20-35mm f/2.8L or Tokina Lens"));
   puts(lens_sanatize("Canon EF 100-300mm f/5.6 or Sigma or Tokina Lens"));
   puts(lens_sanatize("smc PENTAX-F 50mm F1.4"));
   puts(lens_sanatize("smc PENTAX-F 28-80mm F3.5-4.5 or Tokina Lens"));
   puts(lens_sanatize("smc PENTAX-FA 28-200mm F3.8-5.6 AL[IF] or Tamron Lens"));
   puts(lens_sanatize("AF Zoom-Micro Nikkor 70-180mm f/4.5-5.6D ED"));
   return 0;
}
------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire 
the most talented Cisco Certified professionals. Visit the 
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
_______________________________________________
darktable-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/darktable-devel

Reply via email to