diff --git a/src/backend/model/fileaccess/MetadataLoader.ts b/src/backend/model/fileaccess/MetadataLoader.ts index 8cd76d49..88be5394 100644 --- a/src/backend/model/fileaccess/MetadataLoader.ts +++ b/src/backend/model/fileaccess/MetadataLoader.ts @@ -32,7 +32,7 @@ export class MetadataLoader { fileSize: 0, fps: 0, }; - + try { // search for sidecar and merge metadata const fullPathWithoutExt = path.parse(fullPath).name; @@ -180,6 +180,28 @@ export class MetadataLoader { // ignoring errors } + try { + // search for sidecar and merge metadata + const fullPathWithoutExt = path.parse(fullPath).name; + const sidecarPaths = [ + fullPath + '.xmp', + fullPath + '.XMP', + fullPathWithoutExt + '.xmp', + fullPathWithoutExt + '.XMP', + ]; + + for (const sidecarPath of sidecarPaths) { + if (fs.existsSync(sidecarPath)) { + const sidecarData = exifr.sidecar(sidecarPath); + sidecarData.then((response) => { + metadata.keywords = [(response as any).dc.subject].flat(); + }); + } + } + } catch (err) { + // ignoring errors + } + try { const exif = ExifParserFactory.create(data).parse(); if (