Main Menu

Question about -echo

Started by BogdanH, December 17, 2011, 06:38:30 AM

Previous topic - Next topic

BogdanH

Hi Phil,

I would expect, that following:
exiftool -S -exif:Artist -echo "XMP section" -xmp:City image.jpg
-would result with:
Artist: Myname
XMP section
City: MyCity

However, echo is always displayed before tag values. Is that by design?

Bogdan

Phil Harvey

#1
Hi Bogdan,

Yes, this is by design, but it does manage to confuse people.  The reason is because the command line options are processed only once, before processing any files.  So options which are applied to files will come after the others.

- Phil

Edit: I see what you are trying to do.  Why not just use the -g option if you are dividing the output by groups?
...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 ($).

BogdanH

#2
I understand. For what I'm doing now, it would be handy if I could "echo" some text (not neccessary group name) anywhere between regular output lines -and so, echo came to my mind first.
But it's not that important -execept a bit more coding is required on my side  :)

Another idea came to my mind... for example:
-exiftool -s3 -f -exif:Artist myFile.jpg
..will output "-" in case tag Artist isn't defined. And:
-exiftool -s3 -f -exif:NoTag myFile.jpg
..will always result with "-", because tag NoTag doesn't exist at all.

The following example commands will produce the same output:
-exiftool -s3 -f -Artist -exif:NoTag -Coutry myFile.jpg
-exiftool -s3 -f -Artist -NoTag -Coutry myFile.jpg
-exiftool -s3 -f -Artist -NoGroup:NoTag -Coutry myFile.jpg
Now, which of above will ExifTool execute (return result) faster? Or is there even faster way to get output line inbetween?

Bogdan

Phil Harvey

Hi Bogdan,

I thought about the -f option, but didn't mention it because it changes the output for the other tags, but if you are using the -s3 option then you will need to use -f to keep track of which value goes with which tag.

There is likely no noticeable difference in speed between your 3 commands, although in theory the one without a group name executes a bit less code.  Adding bogus tags like this in the command should be very fast -- I can't think of anything faster.

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

BogdanH

Hi Phil,
I'm working on user customizable ExifTool output and in my case usage of -s3 -f combination needed -and you're right: keeping track on "what goes where" is essential in this case.

I assumed that differences in speed aren't worlds apart, but being a bit nitpicky
Quote
...in theory the one without a group name executes a bit less code.
-I'll use this one  :)

Thanks for answering,
Bogdan

Phil Harvey

Hi Bogdan,

Makes sense.  However, I have a comment:

I'm not sure why you're using the -s option, but I can see 2 possible reasons not to do this:

1) This way you won't be able to take advantage of the -lang option for tag descriptions.

2) If you don't use -s, then you will see your fake tag name echoed back in the output.

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

BogdanH

Hi Phil,

Could be I have missed something, but I think, -lang option is usefull only in case ExifTool is used as metadata viewer -because, for modifying, (short) english tag names must be used anyway. And I think, it can be very confusing to modify a tag which name is displayed in non-english language.. something like: I need to change "Horizontale Bildauflösung"... what tag name must I specify? Btw. on what I'm working now, -lang option in ET direct has effect in "Log window" now -at least something  :)

About fake tags (I know what you mean)... I'm working on "high" customizable Quick view, where user can define the sequence of tags displayed and can also define what name to display for particular tag. That's why I use -f option here (to keep sequence). And because tag names are defined by user anyway, I don't need them from ExifTool (that's why -s3 option) -user defined names are displayed instead. And at last: fake tag is used for user defined "group" name (I could use -g0 here, but then I can't keep user defined tag sequence).
I know, without seeing/trying, it sounds weird what I just wrote. Anyway, in Quick view, GUI needs to take care that user defined tag names are synchronized with ExifTool output and handled properly when editing. It works so far...

As always, your comments/remarks are of great value for me -thank you.

Bogdan

Phil Harvey

Thanks for explaining.  Your customizable tags sound great.

You're correct that tag names are always in English, but you could show the translated descriptions in your application instead of the tag names. However, doing this properly is a fair bit of work:

1) When your application first starts, run "exiftool -ver" to get the version number.

2) If this is the first time running a new exiftool version, run "exiftool -listx" to get a full list of ExifTool tag names and descriptions in all languages.  Parse the output XML and build a database to convert from tag names to descriptions.  Save this database for quick loading the next time your application is launched.

3) In the GUI, display only tag descriptions in the selected language, using the database to do the translations for you.

Honestly, this may be more work than it's worth, so I'm not suggesting that you do this.  I'm just pointing out that it is possible.

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

BogdanH

Now I got it!
I wasn't aware of what -listx actually does. I mean, even I probably did tried -listx in the past, somewhere in my head, it was just "one of the list" options.
In your documentation, there's i.e.:
-listx -EXIF:All    # list database of EXIF tags in XML format
Maybe you should put more complete description there:
-listx -EXIF:All    # list XML database of EXIF tags (with multi-language translations).
...or similar. This way, difference between -listx and other -list options would be more apparent.

Anyway, you made me think about your idea very, very seriously... and if I succeed on that, I can retire, right?  :)

Bogdan

Phil Harvey

Hi Bogdan,

Thanks for the suggestion.  I'll add a note about the language translations to that section (but I can't do it exactly as you suggest because the line is too long).

Retire?  Sounds good!  I'm looking forward to my retirement too so I can spend more time working on ExifTool... ;)

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