patch to allow track and disk numbers as integers in QuickTime

Started by dae65, July 23, 2020, 05:32:36 AM

Previous topic - Next topic

dae65

The ValueConvInv entries for both TrackNumber and DiskNumber in %Image::ExifTool::QuickTime::ItemList are currently defined as:

my @a = split / of /, $val; @a==2 ? pack("n3",0,@a) : undef

which works only if $val conforms to some <integer> of <integer> format. When users set TrackNumber or DiskNumber to just an integer, though, the corresponding tag is deleted. When the total number of tracks or disks is unknown, users have to set those tags to, say, "2 of 0" or "17 of 0" to avoid this, which is awkward.

I suggest ValueConvInv should conservatively read as follows:

my @a = split / of /, $val; @a==2 ? pack("n3",0,@a) : ($val=~/^[0-9]+$/ ? pack("n3",0,$val,0) : undef)

in order for users to be allowed to set TrackNumber and DiskNumber to integers by providing a default extra zero if need be.

Please find a diff file attached.

Thanks

Phil Harvey

I tried to look into this to see if this was a valid use of the tag, but I couldn't find a reference.

But this looks OK to me, so I'll add this patch.

Thanks.

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

dae65