Author Topic: [solved] config file with composite tag  (Read 2052 times)

orax

  • Jr. Member
  • **
  • Posts: 19
[solved] config file with composite tag
« on: June 14, 2014, 11:10:14 AM »
Hi, another problem, again…

exiftool -ver
9.63


exiftool "-XMP:HierarchicalSubject=a|b|c" IMG.jpg
    1 image files updated


exiftool -config config.txt "-UD_XMPHierarchicalSubject" IMG.jpg
UD XMP Hierarchical Subject     : (a) (b)


exiftool -config config.txt "-Caption-Abstract<UD_XMPHierarchicalSubject" IMG.jpg
Warning: No writable tags set from IMG.jpg
    0 image files updated
    1 image files unchanged


I don't understand why the last example is not functional…

config.txt :
Code: [Select]
%Image::ExifTool::UserDefined = (
   'Image::ExifTool::Composite' => {
       UD_XMPHierarchicalSubject => {
           Require => 'XMP:HierarchicalSubject',
           ValueConv => '$val =~ /(a)\|(b)\|c/ ? "(". $1 .") (". $2 .")" : undef',
       },
   },
);
1; # end

Edit : Yes, it's Caption-Abstract. Not Caption.
« Last Edit: June 14, 2014, 12:50:08 PM by orax »

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16885
    • ExifTool Home Page
Re: config file with composite tag
« Reply #1 on: June 14, 2014, 11:50:12 AM »
This is tricky.  The problem is that your user-defined tag isn't taking into account that HierarchicalSubject is a List-type tag.  So it will fail if there is more than one value, or the -struct option is used.  The latter is the reason for it failing when copying from another file.  Try this:

Code: [Select]
%Image::ExifTool::UserDefined = (
    'Image::ExifTool::Composite' => {
        UD_XMPHierarchicalSubject => {
            Require => 'XMP:HierarchicalSubject',
            ValueConv => q{
                my ($v) = ref $val eq 'ARRAY' ? $$val[0] : $val;
                $v =~ /(a)\|(b)\|c/ ? "(". $1 .") (". $2 .")" : undef;
            },
        },
    },
);
1; # end

Also, I imagine that you meant Caption-Abstract (the IPTC tag), and not just Caption (a proprietary ACDSee XMP tag) in your command.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

orax

  • Jr. Member
  • **
  • Posts: 19
Re: config file with composite tag
« Reply #2 on: June 14, 2014, 12:28:17 PM »
Hmm, ok ! I understand now.

Problem solved. Thanks !