Get new tag info with -listx for structure type tag Fields

Started by Curtis, March 18, 2016, 07:53:03 PM

Previous topic - Next topic

Curtis

Hi Phil,  (sorry in advance for the long post....)

Been a while, but this question is related to a similar topic in my post here https://exiftool.org/forum/index.php/topic,5415.msg26267.html#msg26267, using the  exiftool feature of getting info for new tags after getting tags from a file that has new tags, using -listx.

I was testing my program with your test file OpenDoc.ods (from Image-ExifTool-10.10.tag.gz) and I'm trying to get the new tags created by using -listx after I use exiftool to get the tag values.  Specifically I want to get the new tag info using the least amount of output from -listx (by using the -<g1>:all option).

To start, I get tag data from  OpenDoc.ods using '-struct -X -t -l' which exiftool returns:

                  :
    <other tag data removed>
                  :
                  :
<XMP-meta:Document-statistic>
    <rdf:Description et:id="meta:document-statistic" et:table="XMP::other">
      <et:desc>Document-statistic</et:desc>
      <et:prt rdf:parseType="Resource">
        <XMP-meta:Cell-count>0</XMP-meta:Cell-count>
        <XMP-meta:Object-count>0</XMP-meta:Object-count>
        <XMP-meta:Table-count>3</XMP-meta:Table-count>
      </et:prt>
      <et:val rdf:parseType="Resource">
        <XMP-meta:Cell-count>0</XMP-meta:Cell-count>
        <XMP-meta:Object-count>0</XMP-meta:Object-count>
        <XMP-meta:Table-count>3</XMP-meta:Table-count>
      </et:val>
    </rdf:Description>
  </XMP-meta:Document-statistic>
                  :
                  :
    <other tag data removed>
                  :


(From the above I believe/assume Document-statistic and its Fields: Cell-count, Object-count and Table-count are all in the group1 group XMP-meta)

I process this output to first discover the XMP-meta:Document-statistic is new, so I then call exiftool again with -listx -XMP-meta:all and it returns:
<?xml version='1.0' encoding='UTF-8'?>
<!-- Generated by Image::ExifTool 10.10 -->
<taginfo>

<table name='XMP::other' g0='XMP' g1='XMP' g2='Unknown'>
<desc lang='en'>XMP other</desc>
<tag id='meta:document-statistic' name='Document-statistic' type='struct' writable='false' g1='XMP-meta'>
  <desc lang='en'>Document-statistic</desc>
</tag>
</table>

</taginfo>


I expected it to also include info for the Cell-count, Object-count and Table-count tags since they are also in XMP-meta.  Desired output would be:
<?xml version='1.0' encoding='UTF-8'?>
<!-- Generated by Image::ExifTool 10.10 -->
<taginfo>

<table name='XMP::other' g0='XMP' g1='XMP' g2='Unknown'>
<desc lang='en'>XMP other</desc>
<tag id='meta:document-statistic' name='Document-statistic' type='struct' writable='false' g1='XMP-meta'>
  <desc lang='en'>Document-statistic</desc>
</tag>
<tag id='meta:document-statisticCell-count' name='Document-statisticCell-count' type='?' writable='false'>
  <desc lang='en'>Document-statistic Cell-count</desc>
</tag>
<tag id='meta:document-statisticObject-count' name='Document-statisticObject-count' type='?' writable='false'>
  <desc lang='en'>Document-statistic Object-count</desc>
</tag>
<tag id='meta:document-statisticTable-count' name='Document-statisticTable-count' type='?' writable='false'>
  <desc lang='en'>Document-statistic Table-count</desc>
</tag>
</table>

</taginfo>


As a test I looked at the output from -listx (304,464 lines of output) and found (at about line 299,016)

<?xml version='1.0' encoding='UTF-8'?>
<!-- Generated by Image::ExifTool 10.10 -->
<taginfo>
                  :
                  :
    <many, many irrelevant lines removed>
                  :
<table name='XMP::other' g0='XMP' g1='XMP' g2='Unknown'>
                  :
                  :
    <some irrelevant lines removed>
                  :
<tag id='meta:document-statistic' name='Document-statistic' type='struct' writable='false' g1='XMP-meta'>
  <desc lang='en'>Document-statistic</desc>
</tag>
<tag id='meta:document-statisticCell-count' name='Document-statisticCell-count' type='?' writable='false'>
  <desc lang='en'>Document-statistic Cell-count</desc>
</tag>
<tag id='meta:document-statisticObject-count' name='Document-statisticObject-count' type='?' writable='false'>
  <desc lang='en'>Document-statistic Object-count</desc>
</tag>
<tag id='meta:document-statisticTable-count' name='Document-statisticTable-count' type='?' writable='false'>
  <desc lang='en'>Document-statistic Table-count</desc>
</tag>
                  :
                  :
    <some irrelevant lines removed>
                  :
</table>
                  :
                  :
    <more irrelevant lines removed>
                  :
</taginfo>


which indeed has the tag info for XMP-meta:Cell-countXMP-meta:Object-count and XMP-meta:Table-count. So the info is there just not gotten with the -listx -XMP-meta:all. Would be nice if it did, since using -listx (all) takes several seconds to execute. 

Am I missing some other way to do this  OR  would it be possible for -listx when using a -<g1>:all option to also output all the Fields of any struct type tag?

Thanks as usual for any help!
Curtis




Curtis

One other related question is that it seems like the et:id="meta:document-statistic"  from tag data from  OpenDoc.ods using '-struct -X -t -l' as shown below, should be et:id="document-statistic",  or am I missing something (again)?  :-\

Thanks for any insights!
Curtis


                  :
    <other tag data removed>
                  :
                  :
<XMP-meta:Document-statistic>
    <rdf:Description et:id="meta:document-statistic" et:table="XMP::other">
      <et:desc>Document-statistic</et:desc>
      <et:prt rdf:parseType="Resource">
        <XMP-meta:Cell-count>0</XMP-meta:Cell-count>
        <XMP-meta:Object-count>0</XMP-meta:Object-count>
        <XMP-meta:Table-count>3</XMP-meta:Table-count>
      </et:prt>
      <et:val rdf:parseType="Resource">
        <XMP-meta:Cell-count>0</XMP-meta:Cell-count>
        <XMP-meta:Object-count>0</XMP-meta:Object-count>
        <XMP-meta:Table-count>3</XMP-meta:Table-count>
      </et:val>
    </rdf:Description>
  </XMP-meta:Document-statistic>
                  :
                  :
    <other tag data removed>
                  :


Curtis

I think I figured out some things. 

First, looking at the -listx (all) output after executing exiftool to read the tags from OpenDoc.ods, I see the default g1 is XMP  (given in the table element) and only the Document-statistic tag overrides this g1 with XMP-meta, hence the only tag I get back from -listx -XMP-meta:all is the Document-statistic tag .  If I do -listx -XMP:all then I get all the tags listed that are in the <table name='XMP::other' g0='XMP' g1='XMP' g2='Unknown'> which are all the ones I need, and even though this output is big (12,706 lines) it is still much smaller than the -listx (all) output (304,464 lines).

But, programmatically how would I know from the '-struct -X -t -l' output to look in the XMP group with my -listx ?  Seems I'm stuck with doing -listx (all)...  :(

Would be great to have a -listx option to get all the tags added by the last 'tag reading' -execute of exiftool....   ::) (probably asking for too much here..  :-\)

Any ideas?

Curtis

Complete 'exiftool -struct -X -t -l' output:
<rdf:Description rdf:about="D:/Users_Norm/Documents/Visual Studio 2015/Projects/Active/ActiveSolutions/Test Problem files/AOpenDoc.ods" xmlns:et="http://ns.exiftool.ca/1.0/" et:toolkit="Image::ExifTool 10.10" xmlns:ExifTool="http://ns.exiftool.ca/ExifTool/1.0/" xmlns:System="http://ns.exiftool.ca/File/System/1.0/" xmlns:File="http://ns.exiftool.ca/File/1.0/" xmlns:XMP-grddl="http://ns.exiftool.ca/XMP/XMP-grddl/1.0/" xmlns:XMP-meta="http://ns.exiftool.ca/XMP/XMP-meta/1.0/" xmlns:XMP-dc="http://ns.exiftool.ca/XMP/XMP-dc/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  <ExifTool:ExifToolVersion>
    <rdf:Description et:id="ExifToolVersion" et:table="Extra">
      <et:desc>ExifTool Version Number</et:desc>
      <et:prt>10.10</et:prt>
    </rdf:Description>
  </ExifTool:ExifToolVersion>
  <System:FileName>
    <rdf:Description et:id="FileName" et:table="Extra">
      <et:desc>File Name</et:desc>
      <et:prt>AOpenDoc.ods</et:prt>
    </rdf:Description>
  </System:FileName>
  <System:Directory>
    <rdf:Description et:id="Directory" et:table="Extra">
      <et:desc>Directory</et:desc>
      <et:prt>D:/Users_Norm/Documents/Visual Studio 2015/Projects/Active/ActiveSolutions/Test Problem files</et:prt>
    </rdf:Description>
  </System:Directory>
  <System:FileSize>
    <rdf:Description et:id="FileSize" et:table="Extra">
      <et:desc>File Size</et:desc>
      <et:prt>6.9 kB</et:prt>
      <et:val>7037</et:val>
    </rdf:Description>
  </System:FileSize>
  <System:FileModifyDate>
    <rdf:Description et:id="FileModifyDate" et:table="Extra">
      <et:desc>File Modification Date/Time</et:desc>
      <et:prt>2010:05:13 07:39:54-07:00</et:prt>
    </rdf:Description>
  </System:FileModifyDate>
  <System:FileAccessDate>
    <rdf:Description et:id="FileAccessDate" et:table="Extra">
      <et:desc>File Access Date/Time</et:desc>
      <et:prt>2016:03:17 09:18:14-07:00</et:prt>
    </rdf:Description>
  </System:FileAccessDate>
  <System:FileCreateDate>
    <rdf:Description et:id="FileCreateDate" et:table="Extra">
      <et:desc>File Creation Date/Time</et:desc>
      <et:prt>2016:03:17 09:18:14-07:00</et:prt>
    </rdf:Description>
  </System:FileCreateDate>
  <System:FilePermissions>
    <rdf:Description et:id="FilePermissions" et:table="Extra">
      <et:desc>File Permissions</et:desc>
      <et:prt>rw-rw-rw-</et:prt>
      <et:val>666</et:val>
    </rdf:Description>
  </System:FilePermissions>
  <File:FileType>
    <rdf:Description et:id="FileType" et:table="Extra">
      <et:desc>File Type</et:desc>
      <et:prt>ODS</et:prt>
    </rdf:Description>
  </File:FileType>
  <File:FileTypeExtension>
    <rdf:Description et:id="FileTypeExtension" et:table="Extra">
      <et:desc>File Type Extension</et:desc>
      <et:prt>ods</et:prt>
      <et:val>ODS</et:val>
    </rdf:Description>
  </File:FileTypeExtension>
  <File:MIMEType>
    <rdf:Description et:id="MIMEType" et:table="Extra">
      <et:desc>MIME Type</et:desc>
      <et:prt>application/vnd.oasis.opendocument.spreadsheet</et:prt>
    </rdf:Description>
  </File:MIMEType>
  <File:PreviewPNG>
    <rdf:Description et:id="PreviewPNG" et:table="Extra">
      <et:desc>Preview PNG</et:desc>
      <et:prt>(Binary data 697 bytes, use -b option to extract)</et:prt>
    </rdf:Description>
  </File:PreviewPNG>
  <XMP-grddl:Transformation>
    <rdf:Description et:id="grddl:transformation" et:table="XMP::other">
      <et:desc>Transformation</et:desc>
      <et:prt>http://docs.oasis-open.org/office/1.2/xslt/odf2rdf.xsl</et:prt>
    </rdf:Description>
  </XMP-grddl:Transformation>
  <XMP-meta:Initial-creator>
    <rdf:Description et:id="meta:initial-creator" et:table="XMP::other">
      <et:desc>Initial-creator</et:desc>
      <et:prt>IDHW IDHW Informatica</et:prt>
    </rdf:Description>
  </XMP-meta:Initial-creator>
  <XMP-meta:Creation-date>
    <rdf:Description et:id="meta:creation-date" et:table="XMP::other">
      <et:desc>Creation-date</et:desc>
      <et:prt>2010:04:19 11:16:49.13</et:prt>
    </rdf:Description>
  </XMP-meta:Creation-date>
  <XMP-meta:Keyword>
    <rdf:Description et:id="meta:keyword" et:table="XMP::other">
      <et:desc>Keyword</et:desc>
      <et:prt>test</et:prt>
    </rdf:Description>
  </XMP-meta:Keyword>
  <XMP-meta:Editing-duration>
    <rdf:Description et:id="meta:editing-duration" et:table="XMP::other">
      <et:desc>Editing-duration</et:desc>
      <et:prt>PT00H01M17S</et:prt>
    </rdf:Description>
  </XMP-meta:Editing-duration>
  <XMP-meta:Editing-cycles>
    <rdf:Description et:id="meta:editing-cycles" et:table="XMP::other">
      <et:desc>Editing-cycles</et:desc>
      <et:prt>1</et:prt>
    </rdf:Description>
  </XMP-meta:Editing-cycles>
  <XMP-meta:Document-statistic>
    <rdf:Description et:id="meta:document-statistic" et:table="XMP::other">
      <et:desc>Document-statistic</et:desc>
      <et:prt rdf:parseType="Resource">
        <XMP-meta:Cell-count>0</XMP-meta:Cell-count>
        <XMP-meta:Object-count>0</XMP-meta:Object-count>
        <XMP-meta:Table-count>3</XMP-meta:Table-count>
      </et:prt>
      <et:val rdf:parseType="Resource">
        <XMP-meta:Cell-count>0</XMP-meta:Cell-count>
        <XMP-meta:Object-count>0</XMP-meta:Object-count>
        <XMP-meta:Table-count>3</XMP-meta:Table-count>
      </et:val>
    </rdf:Description>
  </XMP-meta:Document-statistic>
  <XMP-meta:Generator>
    <rdf:Description et:id="meta:generator" et:table="XMP::other">
      <et:desc>Generator</et:desc>
      <et:prt>OpenOffice.org/3.2$Win32 OpenOffice.org_project/320m12$Build-9483</et:prt>
    </rdf:Description>
  </XMP-meta:Generator>
  <XMP-meta:User-definedName>
    <rdf:Description et:id="meta:user-definedName" et:table="XMP::other">
      <et:desc>User-defined Name</et:desc>
      <et:prt>License</et:prt>
    </rdf:Description>
  </XMP-meta:User-definedName>
  <XMP-meta:User-defined>
    <rdf:Description et:id="meta:user-defined" et:table="XMP::other">
      <et:desc>User-defined</et:desc>
      <et:prt>test</et:prt>
    </rdf:Description>
  </XMP-meta:User-defined>
  <XMP-dc:Title>
    <rdf:Description et:id="title" et:table="XMP::dc">
      <et:desc>Title</et:desc>
      <et:prt>test</et:prt>
    </rdf:Description>
  </XMP-dc:Title>
  <XMP-dc:Subject>
    <rdf:Description et:id="subject" et:table="XMP::dc">
      <et:desc>Subject</et:desc>
      <et:prt>test</et:prt>
    </rdf:Description>
  </XMP-dc:Subject>
  <XMP-dc:Description>
    <rdf:Description et:id="description" et:table="XMP::dc">
      <et:desc>Description</et:desc>
      <et:prt>test</et:prt>
    </rdf:Description>
  </XMP-dc:Description>
  <XMP-dc:Date>
    <rdf:Description et:id="date" et:table="XMP::dc">
      <et:desc>Date</et:desc>
      <et:prt>2010:04:19 11:18:04.30</et:prt>
    </rdf:Description>
  </XMP-dc:Date>
  <XMP-dc:Creator>
    <rdf:Description et:id="creator" et:table="XMP::dc">
      <et:desc>Creator</et:desc>
      <et:prt>IDHW IDHW Informatica</et:prt>
    </rdf:Description>
  </XMP-dc:Creator>
</rdf:Description>


Relevant part of the  -listx -XMP:all output:
<table name='XMP::other' g0='XMP' g1='XMP' g2='Unknown'>
<desc lang='en'>XMP other</desc>
<tag id='grddl:transformation' name='Transformation' type='?' writable='false'>
  <desc lang='en'>Transformation</desc>
  <desc lang='es'>Transformación</desc>
  <desc lang='fi'>Muunto</desc>
  <desc lang='it'>Trasformazione</desc>
  <desc lang='ja'>変形</desc>
  <desc lang='pl'>PrzeksztaÅ,cenie</desc>
</tag>
<tag id='meta:creation-date' name='Creation-date' type='?' writable='false'>
  <desc lang='en'>Creation-date</desc>
</tag>
<tag id='meta:document-statistic' name='Document-statistic' type='struct' writable='false' g1='XMP-meta'>
  <desc lang='en'>Document-statistic</desc>
</tag>
<tag id='meta:document-statisticCell-count' name='Document-statisticCell-count' type='?' writable='false'>
  <desc lang='en'>Document-statistic Cell-count</desc>
</tag>
<tag id='meta:document-statisticObject-count' name='Document-statisticObject-count' type='?' writable='false'>
  <desc lang='en'>Document-statistic Object-count</desc>
</tag>
<tag id='meta:document-statisticTable-count' name='Document-statisticTable-count' type='?' writable='false'>
  <desc lang='en'>Document-statistic Table-count</desc>
</tag>
<tag id='meta:editing-cycles' name='Editing-cycles' type='?' writable='false'>
  <desc lang='en'>Editing-cycles</desc>
</tag>
<tag id='meta:editing-duration' name='Editing-duration' type='?' writable='false'>
  <desc lang='en'>Editing-duration</desc>
</tag>
<tag id='meta:generator' name='Generator' type='?' writable='false'>
  <desc lang='en'>Generator</desc>
</tag>
<tag id='meta:initial-creator' name='Initial-creator' type='?' writable='false'>
  <desc lang='en'>Initial-creator</desc>
</tag>
<tag id='meta:keyword' name='Keyword' type='?' writable='false'>
  <desc lang='en'>Keyword</desc>
  <desc lang='cs'>Klíčová slova</desc>
  <desc lang='de'>Schlüsselwort</desc>
  <desc lang='es'>Palabras Clave</desc>
  <desc lang='fi'>Avainsana</desc>
  <desc lang='fr'>Mots clé</desc>
  <desc lang='it'>Parola chiave</desc>
  <desc lang='ja'>ã,­ãƒ¼ãƒ¯ãƒ¼ãƒ‰</desc>
  <desc lang='ko'>í,¤ì›Œë"œ</desc>
  <desc lang='nl'>Trefwoorden</desc>
  <desc lang='zh_cn'>å...³é"®è¯</desc>
  <desc lang='zh_tw'>關鍵字</desc>
</tag>
<tag id='meta:user-defined' name='User-defined' type='?' writable='false'>
  <desc lang='en'>User-defined</desc>
</tag>
<tag id='meta:user-definedName' name='User-definedName' type='?' writable='false'>
  <desc lang='en'>User-defined Name</desc>
</tag>
</table>

Curtis

For now decided to use the table info to feed -listx a group name.  From the tag data output, as example:

<XMP-meta:Document-statistic>
    <rdf:Description et:id="meta:document-statistic" et:table="XMP::other">
      <et:desc>Document-statistic</et:desc>
      <et:prt rdf:parseType="Resource">
        <XMP-meta:Cell-count>0</XMP-meta:Cell-count>
        <XMP-meta:Object-count>0</XMP-meta:Object-count>
        <XMP-meta:Table-count>3</XMP-meta:Table-count>
      </et:prt>
      <et:val rdf:parseType="Resource">
        <XMP-meta:Cell-count>0</XMP-meta:Cell-count>
        <XMP-meta:Object-count>0</XMP-meta:Object-count>
        <XMP-meta:Table-count>3</XMP-meta:Table-count>
      </et:val>
    </rdf:Description>
  </XMP-meta:Document-statistic>


If the first 3 characters of the table name ("XMP::other") are XMP  then I use that for the group name for -listx since I know XMP-meta will not work and I believe, structure type tags are only in the XMP group (correct?). But, this may not always be the case, I shall see with more testing.

Sorry for all these ramblings  :P as I learn more about this... again any ideas or hints are welcome!
Curtis

Phil Harvey

Hi Curtis,

Right.  The -listx option exposes some of the internals that it probably shouldn't.  As you have discovered, ExifTool generates entries in the XMP::other table when it encounters XMP tags that aren't previously defined.  These entries are essentially placeholders, and are not designed to be complete tag definitions, so they probably shouldn't appear in the -listx output at all.  I wouldn't recommend trying to make sense out of these, and would have to spend some time sifting through the code myself to figure out what the differences are between these entries and normal tag definitions.

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

Curtis

Thanks for that insight Phil.  For newly defined tags I'll rely more on how they are actually 'defined/used' in the  '-struct -X -t -l' output.

Thanks as usual!
Curtis