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:
parent
0b817b07fd
commit
3a34300618
@ -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 (
|
||||
|
Loading…
Reference in New Issue
Block a user