Attributes initial values
Extracting the ExifTool:ExifToolVersion metadata allows to ensure that the metadata-read. integration is functional. The metadata ExifTool:ExifToolVersion in always returned by exiftool.
Attribute(s) definition(s) ...
| metadata | value(s) |
|---|
| ExifTool:ExifToolVersion | 13.59 |
... set attribute(s) initial value(s)
| Attributes | initial value(s) |
|---|
| exiftoolVersion | 13.59 |
Values will be separated by " ; "
Attribute(s) definition(s) ...
| metadata | value(s) |
|---|
| IPTC:Keywords | dog ; cat ; bird |
... set attribute(s) initial value(s)
| Attributes | initial value(s) |
|---|
| Keywords | dog ; cat ; bird |
Attribute(s) definition(s) ...
| metadata | value(s) |
|---|
| IPTC:Keywords | dog ; cat ; bird |
... set attribute(s) initial value(s)
| Attributes | initial value(s) |
|---|
| Keywords #1 | dog |
| Keywords #2 | cat |
| Keywords #3 | bird |
warning : Wrong usage of getMetadata(...).value (without "s")
Attribute(s) definition(s) ...
- Keywords:
text ; [X] multi ; [ ] translatable
{{ file.getMetadata('IPTC:Keywords').value }}
| metadata | value(s) |
|---|
| IPTC:Keywords | dog ; cat ; bird |
... set attribute(s) initial value(s)
| Attributes | initial value(s) |
|---|
| Keywords | dog ; cat ; bird |
Good usage of getMetadata(...).values
Attribute(s) definition(s) ...
- Keywords:
text ; [X] multi ; [ ] translatable
{{ file.getMetadata('IPTC:Keywords').values | join("\n") }}
| metadata | value(s) |
|---|
| IPTC:Keywords | dog ; cat ; bird |
... set attribute(s) initial value(s)
| Attributes | initial value(s) |
|---|
| Keywords #1 | dog |
| Keywords #2 | cat |
| Keywords #3 | bird |
6: Mono-value multilocale
Attribute(s) definition(s) ...
| metadata | value(s) |
|---|
| XMP-dc:Creator | Bob |
... set attribute(s) initial value(s)
| Attributes | initial value(s) |
|---|
locale en | |
| Copyright | (c) Bob. All rights reserved |
locale fr | |
| Copyright | (c) Bob. Tous droits réservés |
7: Multi-values multilocale
Attribute(s) definition(s) ...
| metadata | value(s) |
|---|
| XMP-dc:Subject | dog ; cat ; bird |
| IPTC:SupplementalCategories | chien ; chat ; oiseau |
... set attribute(s) initial value(s)
| Attributes | initial value(s) |
|---|
locale en | |
| Keywords #1 | dog |
| Keywords #2 | cat |
| Keywords #3 | bird |
locale fr | |
| Keywords #1 | chien |
| Keywords #2 | chat |
| Keywords #3 | oiseau |
8: Unknown tag
Attribute(s) definition(s) ...
- zAttribute:
text ; [ ] multi ; [ ] translatable
{{ (file.getMetadata('badTag').value ?? 'whaat ?') }}
... set attribute(s) initial value(s)
| Attributes | initial value(s) |
|---|
| zAttribute | whaat ? |
for this test, only the metadata IPTC:City is set.
Attribute(s) definition(s) ...
- City:
text ; [ ] multi ; [ ] translatable
{{ file.getMetadata('XMP-iptcCore:CreatorCity').value ?? file.getMetadata('IPTC:City').value ?? 'no-city ?' }}
| metadata | value(s) |
|---|
| IPTC:City | Paris |
... set attribute(s) initial value(s)
| Attributes | initial value(s) |
|---|
| City | Paris |
for this test, no metadata is set, so the default value is used.
Attribute(s) definition(s) ...
- City:
text ; [ ] multi ; [ ] translatable
{{ file.getMetadata('XMP-iptcCore:CreatorCity').value ?? file.getMetadata('IPTC:City').value ?? 'no-city ?' }}
... set attribute(s) initial value(s)
| Attributes | initial value(s) |
|---|
| City | no-city ? |
Here an array [a, b] is used, the join filter inserts a " - " only if required.
Attribute(s) definition(s) ...
- CreatorLocation:
text ; [ ] multi ; [ ] translatable
{{ [file.getMetadata('XMP-iptcCore:CreatorCity').value, file.getMetadata('XMP-iptcCore:CreatorCountry').value] | join(' - ') }}
| metadata | value(s) |
|---|
| XMP-iptcCore:CreatorCity | Paris |
| XMP-iptcCore:CreatorCountry | France |
... set attribute(s) initial value(s)
| Attributes | initial value(s) |
|---|
| CreatorLocation | Paris - France |
nb: We fill an array that will be joined by \n to generate one line per item (required).
The merge filter requires arrays, so IPTC:Keywords defaults to [] in case there is no keywords in metadata.
Attribute(s) definition(s) ...
- Keywords:
text ; [X] multi ; [ ] translatable
{{ ( (file.getMetadata('IPTC:Keywords').values ?? []) | merge([file.getMetadata('IPTC:City').value, file.getMetadata('XMP-photoshop:Country').value ]) ) | join("\n") }}
| metadata | value(s) |
|---|
| IPTC:Keywords | Eiffel Tower ; Seine river |
| IPTC:City | Paris |
| XMP-photoshop:Country | France |
... set attribute(s) initial value(s)
| Attributes | initial value(s) |
|---|
| Keywords #1 | Eiffel Tower |
| Keywords #2 | Seine river |
| Keywords #3 | Paris |
| Keywords #4 | France |
13: Transform code to human readable text
here the ExposureProgram metadata is a code (0...9), used to index an array of strings.
Attribute(s) definition(s) ...
- ExposureProgram:
text ; [ ] multi ; [ ] translatable
{{ [ 'Not Defined', 'Manual', 'Program AE', 'Aperture-priority AE', 'Shutter speed priority AE', 'Creative (Slow speed)', 'Action (High speed)', 'Portrait', 'Landscape', 'Bulb' ][file.getMetadata('ExifIFD:ExposureProgram').value] ?? 'Unknown mode' }}
| metadata | value(s) |
|---|
| ExifIFD:ExposureProgram | 2 |
... set attribute(s) initial value(s)
| Attributes | initial value(s) |
|---|
| ExposureProgram | Program AE |
The readFromMetadata list is evaluated in order; the first tag present in the file metadata is used. Here XMP-iptcCore:CreatorCity is absent, so IPTC:City is used.
Attribute(s) definition(s) ...
| metadata | value(s) |
|---|
| IPTC:City | Paris |
... set attribute(s) initial value(s)
| Attributes | initial value(s) |
|---|
| City | Paris |
Attribute(s) definition(s) ...
| metadata | value(s) |
|---|
| IPTC:Keywords | dog ; cat ; bird |
... set attribute(s) initial value(s)
| Attributes | initial value(s) |
|---|
| Keywords #1 | dog |
| Keywords #2 | cat |
| Keywords #3 | bird |
When none of the listed tags is present, no attribute is created.
Attribute(s) definition(s) ...
... set attribute(s) initial value(s)
| Attributes | initial value(s) |
|---|