Aller au contenu principal
Version: 3.19

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 ...

metadatavalue(s)
ExifTool:ExifToolVersion12.42

... set attribute(s) initial value(s)

Attributesinitial value(s)
exiftoolVersion12.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 ...

metadatavalue(s)
IPTC:Keywordsdog ; cat ; bird

... set attribute(s) initial value(s)

Attributesinitial value(s)
Keywordsdog ; 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 ...

metadatavalue(s)
IPTC:Keywordsdog ; cat ; bird

... set attribute(s) initial value(s)

Attributesinitial value(s)
Keywords #1dog
Keywords #2cat
Keywords #3bird

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 ...

metadatavalue(s)
IPTC:Keywordsdog ; cat ; bird

... set attribute(s) initial value(s)

Attributesinitial value(s)
Keywordsdog ; 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 ...

metadatavalue(s)
IPTC:Keywordsdog ; cat ; bird

... set attribute(s) initial value(s)

Attributesinitial value(s)
Keywords #1dog
Keywords #2cat
Keywords #3bird

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"
    }

... with file metadata ...

metadatavalue(s)
XMP-dc:CreatorBob

... set attribute(s) initial value(s)

Attributesinitial 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"
    }

... with file metadata ...

metadatavalue(s)
XMP-dc:Subjectdog ; cat ; bird
IPTC:SupplementalCategorieschien ; chat ; oiseau

... set attribute(s) initial value(s)

Attributesinitial value(s)
locale en
Keywords #1dog
Keywords #2cat
Keywords #3bird
locale fr
Keywords #1chien
Keywords #2chat
Keywords #3oiseau

8: Unknown tag

Attribute(s) definition(s) ...

  • zAttribute: text ; [ ] multi ; [ ] translatable
{
"type": "template",
"value": "{{ (file.getMetadata('badTag').value ?? 'whaat ?') }}"
}

... with file metadata ...

metadatavalue(s)

... set attribute(s) initial value(s)

Attributesinitial value(s)
zAttributewhaat ?

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 ...

metadatavalue(s)
IPTC:CityParis

... set attribute(s) initial value(s)

Attributesinitial value(s)
CityParis

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 ...

metadatavalue(s)

... set attribute(s) initial value(s)

Attributesinitial value(s)
Cityno-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 ...

metadatavalue(s)
XMP-iptcCore:CreatorCityParis
XMP-iptcCore:CreatorCountryFrance

... set attribute(s) initial value(s)

Attributesinitial value(s)
CreatorLocationParis - 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 ...

metadatavalue(s)
IPTC:KeywordsEiffel Tower ; Seine river
IPTC:CityParis
XMP-photoshop:CountryFrance

... set attribute(s) initial value(s)

Attributesinitial value(s)
Keywords #1Eiffel Tower
Keywords #2Seine river
Keywords #3Paris
Keywords #4France

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 ...

metadatavalue(s)
ExifIFD:ExposureProgram2

... set attribute(s) initial value(s)

Attributesinitial value(s)
ExposureProgramProgram AE