suggestion to add stderr message when reading a single file

Started by ryerman, January 23, 2013, 11:06:09 PM

Previous topic - Next topic

ryerman

Hi Phil

Consider reading 3 files with this command: exiftool -filename file1 file2 file3 2> stderr.txt
File stderr.txt is created, containing one line:  "    3 image files read"

However, reading a single file with this command: exiftool -filename file1 2> stderr.txt, creates stderr.txt which is empty.

I suggest that it would be better to write "    1 image files read" to stderr when reading a single file.
This would be consistent with writing "    1 image files updated", which currently happens when a single file is successfully written.

I have a script that uses the stderr stream from ExifTool to create a report when checking for ID3 tags in a variable number of FLAC files.
Checking for the empty file condition is a work-around but perhaps this minor change is more desirable.

Jim
Windows 10 Home 64 bit, Exiftool v12.61

Phil Harvey

Hi Jim,

I see your point, and will modify the -v0 option so that it does what you request.  It would be very wrong for me to modify the default behaviour of exiftool for a single file (for a number of reasons), but modifying -v0 is fine because it doesn't have any meaning yet when extracting information.

BTW, In your example, the output goes to stdout not stderr.

- Phil

Edit:  Oops.  I just read my documentation.  I forgot, -v0 does have a meaning when extracting information -- it turns on the output autoflush.  Hmmm.  So some developers likely already use -v0 when extracting.  Darn.  I don't want to cause them compatibility issues.  I'll have to think about this some more.
...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 ($).

ryerman

Hi Phil.

It's entirely possible that I'm using vocabulary incorrectly.
But maybe I've caused some confusion by simplifying the example.  I use both stdout (>) and outerr (2>). (I think! :o)
A better example is exiftool -filename file1 file2 file3 > ListOfFileNames.txt 2> stderr.txt
This separates the list of file names from the one line summary that reports how many files were read.

But forget about redirection for now.
Maybe the attached screenshot makes my suggestion clearer.

I guess it boils down to this:  If you say "2 image files read" why can't you say "1 image files read"?

Jim

Windows 10 Home 64 bit, Exiftool v12.61

Phil Harvey

Hi Jim,

Yes, I understood completely.  Ignoring redirection for now, I can't implement your suggestion as-is because it would affect too many users.

But try your redirection examples...  I think you'll find that everything goes to stdout.

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

ryerman

Hi Phil.

OK.

I could always access "everything".  My problem is that "everything" doesn't include the one line summary when reading a single file.
I'll rewrite my script to use what is available.

Thanks for your time,

Jim
Windows 10 Home 64 bit, Exiftool v12.61

Phil Harvey

Hi Jim,

Just to clarify the stdout/stderr issue...  The summary lines go to stderr instead of stdout only if one of the following options is used:

-h -j -X -p -csv -php -htmlDump (with the exception that they always go to stdout if -w is used).

But your example didn't use any of these options, so the summary goes to stdout.

This isn't documented anywhere.

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

ryerman

Hi Phil.

Thanks for the clarification.

Now, just to be sure, is it correct to say: "There is no summary line anywhere when successfully reading a single file without error or warning"?

Jim
Windows 10 Home 64 bit, Exiftool v12.61

Phil Harvey

Hi Jim,

Correct.

But I am adding something to the next release that may allow you to do what in a slightly different way...  I'm enhancing the -echo command to allow its output to come after all other output.  So you could use this if need be to give yourself the bookend(s) you're looking for.

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