I have two related questions.
1) I am executing Exiftool using -stay_open True -@ - from PHP using Symfony's 3.2 Process component and writing commands to stdin using InputStream. Currently I build an array of commands and write those commands to the InputStream (each followed by a new line char) and then a single -execute command. This works for reading metadata and I get back an array of arrays. However, for writing metadata, each image is getting the same metadata - the last tag values. I'm assuming this relates to -TAG[+-]=[VALUE] documentation "Notes" section "1) Many tag values may be assigned in a single command...". My question is, am I misinterpreting the -execute functionality - should I be using it as if I were entering single commands on the command line and pressing enter instead of batch writing commands and using only one -execute.
2) I've encountered some weird behavior where Symfony's 3.2 Process component getErrorOutput() method is catching the messages from exiftool where it reports "n image files read" or "n image files updated". The {ready}\n message is returned on stdout and I've used -q to suppress the "image files" messages, but that is also suppressing the {ready}\n message. I suspect it might have something to do with the Process components callback function changing context, but before I go that route I wanted to clarify exiftool's /usr/bin/perl script. I'm new to Perl and trying to understand line 1710 elsif. Are messages from exiftool using -stay_open True -@ - being returned on stderr?
Quote from: nfourteen on December 30, 2016, 01:59:56 PM
My question is, am I misinterpreting the -execute functionality - should I be using it as if I were entering single commands on the command line and pressing enter instead of batch writing commands and using only one -execute.
The functionality of
-execute is exactly as if a separate command has been executed (with minor exceptions as mentioned in the docs). So
exiftool ARGS1 -execute ARGS2 is exactly the same as
exiftool ARGS1 followed by
exiftool ARGS2.
QuoteAre messages from exiftool using -stay_open True -@ - being returned on stderr?
They are the same as when you aren't using
-stay_open. They go to stderr instead of stdout under some circumstances (eg. to avoid messing up structured output).
If you want to use
-q and still receive the "{ready}" messages, add a
-echo3 or
-echo4 to echo your desired "{ready}" message to stdout or stderr.
- Phil
Excellent! Thank you for such a quick response!