Add option to manually specify file extension inside file names v2 #1321
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Version 2 of my previous PR #1266, sorry about that. Fixed the remaining issue, here's the original description:
Digikam recently changed the behaviour of XMP sidecar files and now they need to match the full file-name of the associated image, ie. what used to be:
is now:
This PR adds the option to use %image_ext% in the file naming process so I can change my filename config to say
image.%image_ext%
.%image_ext%
does not replace the existing extension, adding it to anything other than info files will just duplicate the image's file extension, but who knows maybe someone wants that somewhere, like making directories based on extension I don't know.The new addition is a bit of a wild one, I really wasn't sure on the best way to handle Ugoiras.
The problem I ran into is that, at the time we create metadata files, we don't yet know what ugoira re-encodes we're going to create, and ugoira's are a bit unique in that the original file-type of a ZIP is not usually retained, at least by me anyway.
After a lot of umming and ahhing I decided to add a big If Statement and just rely on the config file options to create additional sidecars, but only where someone has enabled
writeImageXMPPerImage
. This config option currently creates additional XMP files for every image in an album, I think the method of creating multiple re-encodes of Ugoiras is similar enough behaviour that I've integrated it into this option.Not enabling
writeImageXMPPerImage
will make it write just a singlexmp
sidecar still. If you use the new %image_ext% in your info filename format then it will be called.zip.xmp
, not sure who wants that but maybe someone.Finally, if you enable
writeImageXMPPerImage
, have Ugoira re-encodings enabled, but don't specify the%image_ext%
in the Info filename format, then it will technically just write multiple XMP files all with the same filename, overwriting each one. I thought about adding some logic to avoid this to prevent the unnecessary writes but it's basically instant anyway so I didn't bother.Please let me know what you think.
Screenshots
Before:
After: