New tags and condition

Started by et2014, February 25, 2014, 05:22:32 PM

Previous topic - Next topic

et2014

Hi,

I would like to add new XMP tags to get Makernotes in converted XMP files. This works fine for 'individual' tags. e.g. the following lines in .ExifTool_config will add the PhaseDetectAF of the Makernotes to the XMP file. Also the print conversion works fine. For a value of '3' I get 'On (39-point)'


%Image::ExifTool::UserDefined = (
    'Image::ExifTool::XMP::Main' => {
        Nikon => {
            SubDirectory => {
                TagTable => 'Image::ExifTool::UserDefined::Nikon',
            },
        },
    },
);

%Image::ExifTool::UserDefined::Nikon = (
    GROUPS        => { 0 => 'XMP', 1 => 'XMP-Nikon', 2 => 'Image' },
    NAMESPACE     => { 'Nikon' => 'http://ns.myname.com/Nikon/1.0/' },
    WRITABLE      => 'string',
    PhaseDetectAF => {
         PrintConv => {
            0 => 'Off',
            1 => 'On (51-point)',
            2 => 'On (11-point)',
            3 => 'On (39-point)',
        },
   },
);

1;  #end


But I do not succeed if a tag depends on the result of another tag. I used the Nikon.pm file as a reference and added dependent tags with the 'Condition' hash entry in .ExifTool_config, e.g.


%Image::ExifTool::UserDefined = (
    'Image::ExifTool::XMP::Main' => {
        Nikon => {
            SubDirectory => {
                TagTable => 'Image::ExifTool::UserDefined::Nikon',
            },
        },
    },
);

%Image::ExifTool::UserDefined::Nikon = (
    GROUPS        => { 0 => 'XMP', 1 => 'XMP-Nikon', 2 => 'Image' },
    NAMESPACE     => { 'Nikon' => 'http://ns.myname.com/Nikon/1.0/' },
    WRITABLE      => 'string',
    PhaseDetectAF => {
         Name => 'MyPhaseDetectAF',
         PrintConv => {
            0 => 'Off',
            1 => 'On (51-point)',
            2 => 'On (11-point)',
            3 => 'On (39-point)',
        },
    },
    PrimaryAFPoint => {
        Condition => '$$self{MyPhaseDetectAF} == 3',
        PrintConv => {
            12 => 'B5',
        },
    },
    PrimaryAFPoint => {
        PrintConv => {
            12 => 'wrong',
        },
    },
);

1;  #end


Calling exiftool with the xmp file as option I get 'On (39-point)' for PhaseDetectAF but 'wrong' for PrimaryAFPoint. Obviously there is something wrong with the condition. But I could not find any hint or help in the documentaiton.

Thank you very much in advance for your help!

Phil Harvey

Wow.  This seems like a journey doomed to failure.

The tricky conditions in the maker notes are inherently dependent on the structure because the ExifTool datamembers must be stored before the condition is evaluated.  In XMP, the storage order is not well defined, so these conditions won't work.

I don't know what to suggest.  Have you looked into just using the exiftool -X output?  (with -l if you also want to store the numerical values)  It's not XMP, but it is RDF/XML.

- 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 ($).

et2014

Hi Phil,

thanks a lot for your answer! Interesting to hear that it won't work and why it won't work.

-X (and -X -l) works fine. But it is RDF/XML... I like the idea of sidecar files and XMP as a standard format for meta data which can be read by many different tools. For reading and evaluating the additional Makernotes tags also I would write my own software.

Phil Harvey

Have you tried to see if your other utilities can read the -X output?  XMP is RDF/XML too.  The main difference with the -X output is that the namespaces are not part of any standard.  The only other difference is the xml header.

- 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 ($).