ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: et2014 on February 25, 2014, 05:22:32 PM

Title: New tags and condition
Post by: et2014 on February 25, 2014, 05:22:32 PM
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!
Title: Re: New tags and condition
Post by: Phil Harvey on February 25, 2014, 07:36:17 PM
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
Title: Re: New tags and condition
Post by: et2014 on February 26, 2014, 12:36:49 PM
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.
Title: Re: New tags and condition
Post by: Phil Harvey on February 26, 2014, 12:49:54 PM
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