1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2025-01-08 04:03:48 +02:00

Add sidecar support to photos

This commit is contained in:
Graham Alderson 2023-11-16 12:01:58 +12:00
parent 0b817b07fd
commit 3a34300618

View File

@ -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 (