Author Topic: Bug with Advanced formatting @ option  (Read 179 times)

StarGeek

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 2516
Bug with Advanced formatting @ option
« on: April 04, 2019, 05:29:35 PM »
I'm trying to remove keywords based upon the @ feature mentioned in the advanced formatting, but I don't seem to be getting the expected results.  I'm getting a single entries with all the remaining entries joined as one.
Code: [Select]
C:\>exiftool -P -overwrite_original -subject=Test1 -subject=Test2 -Subject=Test3 y:\!temp\Test4.jpg
    1 image files updated

C:\>exiftool -G1 -a -s -sep ## -subject -ExifToolVersion y:\!temp\Test4.jpg
[XMP-dc]        Subject                         : Test1##Test2##Test3
[ExifTool]      ExifToolVersion                 : 11.33

C:\>exiftool -P -overwrite_original -sep ## "-subject<${Subject@;$_=undef if m/Test2/}" y:\!temp\Test4.jpg
    1 image files updated

C:\>exiftool -G1 -a -s -sep ## -subject -ExifToolVersion y:\!temp\Test4.jpg
[XMP-dc]        Subject                         : Test1, Test3
[ExifTool]      ExifToolVersion                 : 11.33

If I go back to the version where you first mention it (ver 10.87), I still get the wrong results, but it seems to work correctly in ver 10.86

Code: [Select]
C:\>"C:\Programs\UnixUtils\ExifTool\exiftool_10.86.exe" -P -overwrite_original -subject=Test1 -subject=Test2 -Subject=Test3 y:\!temp\Test4.jpg
    1 image files updated

C:\>"C:\Programs\UnixUtils\ExifTool\exiftool_10.86.exe" -G1 -a -s -sep ## -subject -ExifToolVersion y:\!temp\Test4.jpg
[XMP-dc]        Subject                         : Test1##Test2##Test3
[ExifTool]      ExifToolVersion                 : 10.86

C:\>"C:\Programs\UnixUtils\ExifTool\exiftool_10.86.exe" -P -overwrite_original -sep ## "-subject<${Subject@;$_=undef if m/Test2/}" y:\!temp\Test4.jpg
    1 image files updated

C:\>"C:\Programs\UnixUtils\ExifTool\exiftool_10.86.exe" -G1 -a -s -sep ## -subject -ExifToolVersion y:\!temp\Test4.jpg
[XMP-dc]        Subject                         : Test1##Test3
[ExifTool]      ExifToolVersion                 : 10.86

C:\>"C:\Programs\UnixUtils\ExifTool\exiftool_10.87.exe" -P -overwrite_original -subject=Test1 -subject=Test2 -Subject=Test3 y:\!temp\Test4.jpg
    1 image files updated

C:\>"C:\Programs\UnixUtils\ExifTool\exiftool_10.87.exe" -G1 -a -s -sep ## -subject -ExifToolVersion y:\!temp\Test4.jpg
[XMP-dc]        Subject                         : Test1##Test2##Test3
[ExifTool]      ExifToolVersion                 : 10.87

C:\>"C:\Programs\UnixUtils\ExifTool\exiftool_10.87.exe" -P -overwrite_original -sep ## "-subject<${Subject@;$_=undef if m/Test2/}" y:\!temp\Test4.jpg
    1 image files updated

C:\>"C:\Programs\UnixUtils\ExifTool\exiftool_10.87.exe" -G1 -a -s -sep ## -subject -ExifToolVersion y:\!temp\Test4.jpg
[XMP-dc]        Subject                         : Test1, Test3
[ExifTool]      ExifToolVersion                 : 10.87

Am I in error in my understanding of what it's supposed to do?
Troubleshooting hints:
* When posting, include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).
* Double all percent signs (%) in a Windows batch file.
* If your GPS coords are negative, make sure and set the GpsLatitudeRef and GpsLongitudeRef tags correctly.

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14759
    • ExifTool Home Page
Re: Bug with Advanced formatting @ option
« Reply #1 on: April 04, 2019, 09:54:33 PM »
I'll look into this first thing tomorrow.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14759
    • ExifTool Home Page
Re: Bug with Advanced formatting @ option
« Reply #2 on: April 05, 2019, 07:23:54 AM »
Thanks for this report and for all the details to make this otherwise sort-of-tricky-bug-to-find much easier!

This will be fixed in 11.35.

- Phil

Edit: The problem was that in version 10.54 I had simplified the API List and ListSep options by combining them into a single ListJoin option.  Although I provided for backward compatibility of software using the old options, I didn't think about what would happen if software used a mix of old a new options.  This came back to bite me when I added some new code in 10.87 to use the ListJoin option in the advanced formatting "@" feature, while the rest of the code still used the older options.

BTW, Your command will work for versions 10.87 to 11.34 if you use -sep ", " instead of -sep ##.
« Last Edit: April 05, 2019, 08:49:05 AM by Phil Harvey »
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

StarGeek

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 2516
Re: Bug with Advanced formatting @ option
« Reply #3 on: April 05, 2019, 12:36:47 PM »
BTW, Your command will work for versions 10.87 to 11.34 if you use -sep ", " instead of -sep ##.[/i]

Good to know.  The problem is that sometimes I have commas in my keywords. 
Troubleshooting hints:
* When posting, include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).
* Double all percent signs (%) in a Windows batch file.
* If your GPS coords are negative, make sure and set the GpsLatitudeRef and GpsLongitudeRef tags correctly.