Attributes initial values
1: Check of integration "metadata-read"
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) ...
- exiftoolVersion:
text; [ ]multi; [ ]translatable
{
"type": "metadata",
"value": "ExifTool:ExifToolVersion"
}
... with file metadata ...
| metadata | value(s) |
|---|---|
| ExifTool:ExifToolVersion | 12.42 |
... set attribute(s) initial value(s)
| Attributes | initial value(s) |
|---|---|
| exiftoolVersion | 12.42 |
2: Multi-values metadata -> mono-value attribute ("metadata" method)
Values will be separated by " ; "
Attribute(s) definition(s) ...
- Keywords:
text; [ ]multi; [ ]translatable
{
"type": "metadata",
"value": "IPTC:Keywords"
}
... with file metadata ...
| metadata | value(s) |
|---|---|
| IPTC:Keywords | dog ; cat ; bird |
... set attribute(s) initial value(s)
| Attributes | initial value(s) |
|---|---|
| Keywords | dog ; cat ; bird |
3: Multi-values metadata -> multi-values attribute ("metadata" method)
Attribute(s) definition(s) ...
- Keywords:
text; [X]multi; [ ]translatable
{
"type": "metadata",
"value": "IPTC:Keywords"
}
... with file metadata ...
| 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 |
4: Multi-values metadata -> multi-values attribute ("template" method)
warning : Wrong usage of getMetadata(...).value (without "s")
Attribute(s) definition(s) ...
- Keywords:
text; [X]multi; [ ]translatable
{
"type": "template",
"value": "{{ file.getMetadata('IPTC:Keywords').value }}"
}
... with file metadata ...
| metadata | value(s) |
|---|---|
| IPTC:Keywords | dog ; cat ; bird |
... set attribute(s) initial value(s)
| Attributes | initial value(s) |
|---|---|
| Keywords | dog ; cat ; bird |
5: Multi-values metadata -> multi-values attribute ("template" method)
Good usage of getMetadata(...).values
Attribute(s) definition(s) ...
- Keywords:
text; [X]multi; [ ]translatable
{
"type": "template",
"value": "{{ file.getMetadata('IPTC:Keywords').values | join('\n') }}"
}
... with file metadata ...
| 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) ...
-
Copyright:
text; [ ]multi; [ ]translatable- locale
en
{
"type": "template",
"value": "(c) {{ file.getMetadata('XMP-dc:Creator').value }}. All rights reserved"
}- locale
fr
{
"type": "template",
"value": "(c) {{ file.getMetadata('XMP-dc:Creator').value }}. Tous droits réservés"
} - locale
... with file metadata ...
| 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) ...
-
Keywords:
text; [X]multi; [ ]translatable- locale
en
{
"type": "metadata",
"value": "XMP-dc:Subject"
}- locale
fr
{
"type": "metadata",
"value": "IPTC:SupplementalCategories"
} - locale
... with file metadata ...
| 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
{
"type": "template",
"value": "{{ (file.getMetadata('badTag').value ?? 'whaat ?') }}"
}
... with file metadata ...
| metadata | value(s) |
|---|
... set attribute(s) initial value(s)
| Attributes | initial value(s) |
|---|---|
| zAttribute | whaat ? |
9: First metadata set, with alternate value (1)
for this test, only the metadata IPTC:City is set.
Attribute(s) definition(s) ...
- City:
text; [ ]multi; [ ]translatable
{
"type": "template",
"value": "{{ file.getMetadata('XMP-iptcCore:CreatorCity').value ?? file.getMetadata('IPTC:City').value ?? 'no-city ?' }}"
}
... with file metadata ...
| metadata | value(s) |
|---|---|
| IPTC:City | Paris |
... set attribute(s) initial value(s)
| Attributes | initial value(s) |
|---|---|
| City | Paris |
10: First metadata set, with alternate value (2)
for this test, no metadata is set, so the default value is used.
Attribute(s) definition(s) ...
- City:
text; [ ]multi; [ ]translatable
{
"type": "template",
"value": "{{ file.getMetadata('XMP-iptcCore:CreatorCity').value ?? file.getMetadata('IPTC:City').value ?? 'no-city ?' }}"
}
... with file metadata ...
| metadata | value(s) |
|---|
... set attribute(s) initial value(s)
| Attributes | initial value(s) |
|---|---|
| City | no-city ? |
11: Many metadata to a mono-value attribute
Here an array [a, b] is used, the join filter inserts a " - " only if required.
Attribute(s) definition(s) ...
- CreatorLocation:
text; [ ]multi; [ ]translatable
{
"type": "template",
"value": "{{ [file.getMetadata('XMP-iptcCore:CreatorCity').value, file.getMetadata('XMP-iptcCore:CreatorCountry').value] | join(' - ') }}"
}
... with file metadata ...
| metadata | value(s) |
|---|---|
| XMP-iptcCore:CreatorCity | Paris |
| XMP-iptcCore:CreatorCountry | France |
... set attribute(s) initial value(s)
| Attributes | initial value(s) |
|---|---|
| CreatorLocation | Paris - France |
12: Many metadata to a multi-values attribute
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
{
"type": "template",
"value": "{{ ( (file.getMetadata('IPTC:Keywords').values ?? []) | merge([file.getMetadata('IPTC:City').value, file.getMetadata('XMP-photoshop:Country').value ]) ) | join('\n') }}"
}
... with file metadata ...
| 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
{
"type": "template",
"value": "{{ [ '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' }}"
}
... with file metadata ...
| metadata | value(s) |
|---|---|
| ExifIFD:ExposureProgram | 2 |
... set attribute(s) initial value(s)
| Attributes | initial value(s) |
|---|---|
| ExposureProgram | Program AE |