Most 'compact' way to get both number and print value of a Tag

Started by Curtis, December 10, 2013, 08:06:40 PM

Previous topic - Next topic

Curtis

Currently I'm using the -X -t -n options to get XML output with the table, id and index values and the 'numeric' value, then I invoke Exiftool again without the -n option to get the print converted values. 

Example:
with the -n option
<System:FilePermissions et:id='FilePermissions' et:table='Extra'>666</System:FilePermissions>

and then for without the -n option:
<System:FilePermissions et:id='FilePermissions' et:table='Extra'>rw-rw-rw-</System:FilePermissions>

I see I can use the -l option to get both values (when they are different) but then I get a much more verbose format.  As follows:
<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>


Overall this is probably a little less number of characters than my 2 calls to Exiftool.... but it would be great if there was an option to get output like:

<System:FilePermissions et:id='FilePermissions' et:table='Extra' et:val='666'>rw-rw-rw-</System:FilePermissions>

OR

<System:FilePermissions  et:id='FilePermissions' et:table='Extra'>
   <et:prt>rw-rw-rw-</et:prt>
   <et:val>666</et:val>
  </System:FilePermissions>


I know the above two are not XML/RDF compliant... but they have the info I need and none of the info that I don't need ( et:desc )

Bottom line: I'm trying to get the most compact output that includes:
TagName (g1:Name)
table
id
index
print converted value

and  numerical value (if different from print converted value)

I don't have to use XML, would JSON or PHP output be more compact for what I want?

Also (related to my previous post) when I get output as I am now, for a tag with multiple instances I just (internally) number them 0,1,2,... etc.  Is there a way to get the instance number from Exiftool for these types of tags? (to later use to identify to Exiftool which instance of the tag I want to change) (just saw your last post  :( )

Thanks again!
Curtis

Phil Harvey

XML is much more verbose than JSON or "PHP" format, but the -X -t output is the only one that gives the table name, so I don't see any better options for you.  It seems that other than the XML overhead, you already have exactly what you want, except for the description which you don't use.

- 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

Hi Phil,

yup... looks like I'll stick with XML.  I did convert to using -l though since it gets me both the numeric and print converted values with one invocation of ExifTool.  Did a timing check and surprise, surprise it is nearly twice as fast!

Thanks!
Curtis