FrankBijnen/ExifToolGui

Bug / Improvement: Custom Config Option Not Honored as First Argument in ExifToolGUI

Closed this issue · 7 comments

Description:
When using ExifToolGUI to edit image metadata with custom XMP fields, the GUI does not correctly handle the -config argument for ExifTool. Although the custom configuration file is specified, it is appended at the end of the command line arguments rather than being placed as the first argument, resulting in the -config option being ignored by ExifTool. This prevents the custom XMP fields from being recognized and editable within the GUI.

Repro Steps:

  1. Open ExifToolGUI and navigate to Options → Custom Options.
  2. Enter the custom option -config customtags.cfg to specify a custom configuration for ExifTool. (see Personal Use Case below for example cfg)
  3. Attempt to edit an image file with custom XMP fields defined in customtags.cfg.
  4. Observe that the changes are not saved and an error is outputted indicating that the -config option is ignored because it is not first.

Expected:
The expected behavior is for ExifToolGUI to prepend the specified -config argument at the beginning of the command line for ExifTool, ensuring that the custom configuration file is correctly read and the custom XMP fields are accessible and editable within the GUI.

Actual:
ExifToolGUI appends the -config argument at the end of the command line, causing ExifTool to ignore the custom configuration file and resulting in custom XMP fields not being recognized or editable within the GUI.

Suggested Fix:
Modify ExifToolGUI to allow the -config option to be placed as the first argument in the command line when building ExifTool commands, in accordance with ExifTool's requirements for custom configuration files.

Personal Use Case:
custom-url-xmp.zip (or see customtags.cfg in gist)
exiftool -config customtags.cfg -URLInstagram="http://instagram.com/yourusername" "pic.png"
start ExifToolGUI and modify social media links using something like:
exiftool -config customtags.cfg -echo4 {ready86} -CHARSET FILENAME=UTF8 -CHARSET UTF8 -v0 -overwrite_original -sep * -c %.6f° -API WindowsWideFile=1 -xmp-socialmedia:urlinstagram=http://instagram.com/yourusername pic.png -execute86

Additional Information:
Running: 6.2.9 ExifToolGUI and 12.76 exiftool on Win 10 x64

Impact:
This issue prevents users from leveraging the full capabilities of custom XMP fields within ExifToolGUI, limiting the metadata editing workflow and requiring manual command line operations for tasks that should be achievable via the GUI.

I've been using a simple python script (gist available here) as a workaround to accomplish what I need. Hopefully this gives a better sense of what I'm shooting for in the Personal Use Case above, in the event anything is unclear.

@djdarcy

Thanks for this issue. I really like this kind of input.

I had a quick look, and my first thought is: Internally ExifToolGui passes ALL arguments via an ARGS file and the only option on the command line is 'exiftool -@ "' + TempFile + '"'; (Where TempFile is the name of the ARGS file)
The custom option(s) is also written to the ARGS file and not used on the command line. Maybe that needs changing.

If I have something to test can I ask you to do that?

Frank

Having looked deeper into this, my suspicion is confirmed. The -config option needs to be on the commandline, it can not be used in an args file. And I really need to keep using args files, because they solve all kind of UTF8 problems.
The commandline that works is something like this 'exiftool -config "config_file" - @ args_file'

I have made some modifications and compiled it as Prerel 6.3.0. With this version you can specify, in the INI file directly, not in the GUI, a line 'ETCustomConfig='
With this option I'm able to update your supplied XMP tags.

Could you please download that version and test it yourself?
https://1drv.ms/f/s!AhVJC-QzM33pknOS7KwBi09lgNql?e=n7ztFX

If the test is successful we can later discuss how to add it in ExifToolGui. (I dont want to add it to 'Custom options', because it works different)

Relative to ExifTool.exe:
ETCustomConfig=customtags.cfg

Absolute path:
ETCustomConfig=C:\ExifToolGUI\custom_config\customtags.cfg

Part of the INI file

[GUIsettings]
Language=
AutoRotatePreview=1
FileFilters=*.JPG|*.CR2|*.JPG;*.CR2|*.JPG;*.DNG|*.JPG;*.PEF
DefStartupUse=0
DefStartupDir=c:\
ETOverrideDir=
ETCustomConfig=<Config file to use>
ETTimeOut=5000
DefExportUse=0
DefExportDir=

@FrankBijnen Thanks for the quick patch and the insightful explanation! The ini solution ETCustomConfig=[fully-qualified-path]\[config-file].cfg works exactly I'd hope. It make sense to me that the cfg file should be treated differently and not just relegated to the "custom option" field.

Ideally it would be nice if a DataGrid / Listview control existed to simplify editing parts of the ini. But if you are brainstorming how to better integrate custom XMP metadata, then perhaps the workspace manager could incorporate an OpenFileDialog Windows form to write a line into the workspace ini more strongly associating the workspace ini directly with the CustomConfig grammar itself?

So if the workspace ini looked like so:

[WorkSpaceTags]
Social Media Links=-GUI-SEP^
Creator URL=-XMP-socialMedia:CreatorURL^URL to creator's information
Purchase URL=-XMP-socialMedia:PurchaseURL^URL to purchase the item
Instagram URL=-XMP-socialMedia:URLInstagram^Instagram profile URL
Twitter URL=-XMP-socialMedia:URLTwitter^Twitter profile URL
Facebook URL=-XMP-socialMedia:URLFacebook^Facebook profile URL
Patreon URL=-XMP-socialMedia:URLPatreon^Patreon profile URL
Etsy URL=-XMP-socialMedia:URLEtsy^Etsy shop URL
DeviantArt URL=-XMP-socialMedia:URLDeviantArt^DeviantArt profile URL
Scribd URL=-XMP-socialMedia:URLScribd^Scribd profile URL
Docdroid URL=-XMP-socialMedia:URLDocdroid^Docdroid document URL
Discord URL=-XMP-socialMedia:URLDiscord^Discord invite URL
Tapatalk URL=-XMP-socialMedia:URLTapatalk^Tapatalk profile URL
LinkedIn URL=-XMP-socialMedia:URLLinkedIn^LinkedIn profile URL
YouTube URL=-XMP-socialMedia:URLYouTube^YouTube channel URL
Vimeo URL=-XMP-socialMedia:URLVimeo^Vimeo profile URL
SoundCloud URL=-XMP-socialMedia:URLSoundCloud^SoundCloud profile URL
Spotify URL=-XMP-socialMedia:URLSpotify^Spotify artist profile URL
Bandcamp URL=-XMP-socialMedia:URLBandcamp^Bandcamp artist profile URL
Twitch URL=-XMP-socialMedia:URLTwitch^Twitch channel URL
TikTok URL=-XMP-socialMedia:URLTikTok^TikTok profile URL
Reddit URL=-XMP-socialMedia:URLReddit^Reddit profile or subreddit URL
Pinterest URL=-XMP-socialMedia:URLPinterest^Pinterest profile URL
Behance URL=-XMP-socialMedia:URLBehance^Behance profile URL
Flickr URL=-XMP-socialMedia:URLFlickr^Flickr profile URL
Tumblr URL=-XMP-socialMedia:URLTumblr^Tumblr blog URL
GitHub URL=-XMP-socialMedia:URLGitHub^GitHub profile URL
Medium URL=-XMP-socialMedia:URLMedium^Medium profile URL
Telegram URL=-XMP-socialMedia:URLTelegram^Telegram contact or channel URL
WhatsApp URL=-XMP-socialMedia:URLWhatsApp^WhatsApp contact URL

Then perhaps at the top there might be a line like ...

[WorkSpaceTags]
Social Media Links=-GUI-SEP^
CustomConfig=[fully-qualified-path]\[config-file].cfg
...

Doesn't feel perfect, but the general idea seems like it might be closer to a possible final solution as compared to temporarily storing the CustomConfig in %APPDATA%\ExifToolGui\ExifToolGuiV6.ini.

I'm happy to brainstorm a bit more with you if you'd like. Thanks for the fix, this is very helpful!

Regards,
Dustin

Reopening just so you have the chance to look at my comment and to make it easier for tracking, but if you are happy with the solution you implemented - it gets the job done, so no complaints on my end. :)

@djdarcy Thanks for your feedback.

A few (unrelated) remarks

  • This issue will be included in the next version. Will be named 6.3, and hopefully incude some language modules. That's why I dont want to much GUI changes with texts that need translating.
  • Your suggestion to add the parameter 'CustomConfig' to the Workspace I have to think about. I have little experience with custom configs, but I have the feeling that one can do more than just custom tags. So would an average user look for the option there?
  • I had 2 options in mind. 1) Add a field to the preferences, tab page 'Other', just under 'Exiftool location'. with a button to have an open dialog. 2) Add a menuitem under 'Options', just under 'Custom Options'.
  • Reminder for myself: If the user adds/changes/deletes a custom config, the running ExifTool has to be restarted so the changes take effect.

But please tell me what you think.

Frank

@djdarcy

I have add the option to specify a custom config to the preferences form, and closed the issue.

Frank