1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00

Make the Persons cache distinct on the MediaEntry

This commit is contained in:
Patrik J. Braun 2021-05-11 20:59:55 +02:00
parent d53af51be2
commit 939f17add2

View File

@ -228,7 +228,8 @@ export class IndexingManager implements IIndexingManager {
const scannedFaces = (media[i].metadata as PhotoMetadata).faces || []; const scannedFaces = (media[i].metadata as PhotoMetadata).faces || [];
if ((media[i].metadata as PhotoMetadata).faces) { // if it has faces, cache them if ((media[i].metadata as PhotoMetadata).faces) { // if it has faces, cache them
(media[i].metadata as PhotoMetadataEntity).persons = (media[i].metadata as PhotoMetadata).faces.map(f => f.name); // make the list distinct (some photos may contain the same person multiple times)
(media[i].metadata as PhotoMetadataEntity).persons = [...new Set((media[i].metadata as PhotoMetadata).faces.map(f => f.name))];
} }
delete (media[i].metadata as PhotoMetadata).faces; // this is a separated DB, lets save separately delete (media[i].metadata as PhotoMetadata).faces; // this is a separated DB, lets save separately