Sort output alphabetically

Started by pb, January 16, 2012, 09:29:21 PM

Previous topic - Next topic

pb

This brings to mind a feature request.   It would be easier to notice that a particular tag was not present if the tags were output in alphabetically sorted order.  I presume that currently, they are output in the order in which they appear in the image file.  They should still be grouped by type, though, making it somewhat useless to just pipe through sort.  This would also make it easier to visually scan for a particular tag.

This is also a feature request for exiftoolgui, which could implement it independently.  (Presumably exiftoolgui just shows the tags in the order in which exiftool outputs them.) (I am not cross posting to the gui forum.)

Maybe this feature already exists, but I was not clever enough to find it.

--peter

PH Edit: This topic was split from this thread.

Phil Harvey

#1
Hi Peter,

This is a good suggestion, and it would be fairly easy for me to implement an output which is sorted by tag name as you suggest.  However, I have one concern:  The default output gives descriptions, not tag names (an obvious example being the Model tag, which has "Camera Model Name" as a description).  Sorting on the descriptions would be more difficult, and would depend on the setting of the -lang option.  Also, presumably the output should be sorted by tag name if the -s option is used.

It would be possible to sort on descriptions, but it wouldn't be and easy change and it may incur a performance penalty.  I will look into this.

- Phil

Edit: I did a quick test, and sorting by descriptions slows down exiftool by about 7%.  Not too bad a hit I suppose.  I'll consider adding this feature.
...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 ($).

herb

#2
Hello Phil, hello Peter,

I hope it is ok that I add a comment to the sorting feature request.
I am working on a tool, that sends e.g. the following command to Exiftool
   exiftool -f -G0 -tagname1 -tagname2 <file>.

I use -f option because parsing the Exiftool output my tool needs an unchanged order like
   [group1]     tagdescription1    tagvalue1
   [group2]     tagdescription2    tagvalue2

It would be very helpful taht this reminds unchanged.
Thanks in advance.

Herb

PH Edit: Changed the topic name for the new thread.

Phil Harvey

Hi Herb,

Yes, the current behaviour will not change.

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

pb

I should have made it clear that I was suggesting a new option, not a change in the default behavior.

--peter

Phil Harvey

Hi Peter,

I have a working version now that I am testing.  This version adds a new -sort option, which sorts the output based on the tag descriptions by default, or the tag names if combined with the -s option.  It seems to work well, and I think it should make a useful addition to the feature set.

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

pb

Quote from: Phil Harvey on January 17, 2012, 12:48:02 PM
Hi Peter,

I have a working version now that I am testing.  This version adds a new -sort option, which sorts the output based on the tag descriptions by default, or the tag names if combined with the -s option.  It seems to work well, and I think it should make a useful addition to the feature set.

- Phil

Great!  Thanks.  Next I guess I will have to work on Bogdan to include it as an option.

--peter

BogdanH

Hi,

I have commented your request in GUI section. In short: thinking about this now, I really can't understand why I've waited that long with this in GUI.. laziness, perhaps?  :)
And I was just thinking to "publish" new GUI v5.0 .. now I'm glad I didn't -this sort thing was worth a delay, IMO.

Btw. I'm quite excited with new GUIv5  8)

Bogdan

Phil Harvey

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

Phil Harvey

Quote from: Phil Harvey on January 17, 2012, 07:47:22 AM
Edit: I did a quick test, and sorting by descriptions slows down exiftool by about 7%.  Not too bad a hit I suppose.  I'll consider adding this feature.

Good news:  I have beaten the performance hit down to less than 1.5% through some optimization of the sorting function.  :)

I hope to release this new version (8.76) within the next day or two.

- 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

Good news indeed -I'll wait.

Bogdan

Phil Harvey

You didn't have to wait long... version 8.76 is now available. :)

- 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

Downloaded and allready implemented in new GUI  :)
Your sorting is actually better in behaviour than I expected, i.e: even if option "show hex tag ID prefix" (can't recall the op-code right now) is chosen, tags remain sorted by names (and not by ID, as one would assume) -great.
Not to mention, that sorting within groups is very welcome. And finally, in real usage (forget benchmaks), I didn't notice any speed differences. Good job.

Bogdan

Phil Harvey

Hi Bogdan,

Thanks for the feedback. I'm happy that it is working well for you.

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