[solved] config file with composite tag

Started by orax, June 14, 2014, 11:10:14 AM

Previous topic - Next topic

orax

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 :%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.

Phil Harvey

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:

%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/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

orax

Hmm, ok ! I understand now.

Problem solved. Thanks !