From a4cb1188fe657219c94cfe8cea1dffaa43103185 Mon Sep 17 00:00:00 2001 From: kagahd Date: Sat, 24 Apr 2021 10:32:12 +0200 Subject: [PATCH] #267 add XMP section 'subject' to keywords --- src/backend/model/threading/MetadataLoader.ts | 6 +++++- test/backend/assets/xmp/xmp_subject.json | 14 +++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/backend/model/threading/MetadataLoader.ts b/src/backend/model/threading/MetadataLoader.ts index a1aeab94..60b5b2d9 100644 --- a/src/backend/model/threading/MetadataLoader.ts +++ b/src/backend/model/threading/MetadataLoader.ts @@ -216,7 +216,11 @@ export class MetadataLoader { if (exif.Rating) { metadata.rating = (parseInt(exif.Rating.value, 10) as any); } - + if(exif.subject && exif.subject.value){ + for(let i=0; i < exif.subject.value.length; i++){ + metadata.keywords.push(exif.subject.value[i].value); + } + } if (exif.Orientation) { metadata.orientation = (parseInt(exif.Orientation.value as any, 10) as any); if (OrientationTypes.BOTTOM_LEFT < metadata.orientation) { diff --git a/test/backend/assets/xmp/xmp_subject.json b/test/backend/assets/xmp/xmp_subject.json index a2c1d2b7..219165cc 100644 --- a/test/backend/assets/xmp/xmp_subject.json +++ b/test/backend/assets/xmp/xmp_subject.json @@ -1,10 +1,22 @@ { + "cameraData": { + "ISO": 50, + "exposure": 0.007751937984496124, + "fStop": 2.4, + "focalLength": 4.32, + "make": "samsung", + "model": "SM-G975F" + }, + "creationDate": 1614703656000, + "fileSize": 7909, + "orientation": 1, + "rating": 50, + "Rating": 3, "keywords": [ "Max", "Spaß", "Yanik" ], - "Rating": 3, "size": { "height": 47, "width": 100