mirror of
https://github.com/xuthus83/pigallery2.git
synced 2025-01-14 14:43:17 +08:00
Add sidecar support to photos
This commit is contained in:
parent
0b817b07fd
commit
3a34300618
@ -32,7 +32,7 @@ export class MetadataLoader {
|
|||||||
fileSize: 0,
|
fileSize: 0,
|
||||||
fps: 0,
|
fps: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// search for sidecar and merge metadata
|
// search for sidecar and merge metadata
|
||||||
const fullPathWithoutExt = path.parse(fullPath).name;
|
const fullPathWithoutExt = path.parse(fullPath).name;
|
||||||
@ -180,6 +180,28 @@ export class MetadataLoader {
|
|||||||
// ignoring errors
|
// 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 {
|
try {
|
||||||
const exif = ExifParserFactory.create(data).parse();
|
const exif = ExifParserFactory.create(data).parse();
|
||||||
if (
|
if (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user