diff --git a/src/backend/model/fileaccess/MetadataCreationDate.ts b/src/backend/model/fileaccess/MetadataCreationDate.ts index dc561a0e..f43b9442 100644 --- a/src/backend/model/fileaccess/MetadataCreationDate.ts +++ b/src/backend/model/fileaccess/MetadataCreationDate.ts @@ -1,10 +1,13 @@ //The elements are [tag-name1, tag-name2, type of tag-name2] -//tagname1 is typically a full date time, but in some cases tagname1 and tagname2 together make up a full timestamp +//tagname1 is typically a full date time, but in some cases tagname1 and tagname2 together make up a full timestamp. The type makes it easier to code correct concatenation of tag1 and tag2 //Interesting exiftool forums posts about some of these tags: -//exif.DateTimeOriginal, exif.CreateDate/exif.DateTimeDigitized and exif.ModifyDate: https://exiftool.org/forum/index.php?topic=13170.msg71174#msg71174 +//https://exiftool.org/forum/index.php?topic=13170.msg71174#msg71174 - about the meaning of exif.DateTimeOriginal, exif.CreateDate/exif.DateTimeDigitized and exif.ModifyDate //https://exiftool.org/forum/index.php?topic=15555.msg83536#msg83536 +//This is the PRIORITIZED LIST of tags which Pigallery2 uses to determine the date of creation of pictures. +//The list is used for embedded picture metadata and xmp-sidecar files for both pictures and vidoes. + export const DateTags: [string, string, string][] = [ // Date tag Offset or time tag Type //Description ["exif.DateTimeOriginal", "exif.OffsetTimeOriginal", 'O'], //Date and time when the original image was taken - shutter close time diff --git a/src/backend/model/fileaccess/MetadataLoader.ts b/src/backend/model/fileaccess/MetadataLoader.ts index 17f1659c..6e3f4811 100644 --- a/src/backend/model/fileaccess/MetadataLoader.ts +++ b/src/backend/model/fileaccess/MetadataLoader.ts @@ -249,6 +249,7 @@ export class MetadataLoader { if (fs.existsSync(sidecarPath)) { const sidecarData: any = await exifr.sidecar(sidecarPath, exifrOptions); if (sidecarData !== undefined) { + //note that since side cars are loaded last, data loaded here overwrites embedded metadata (in Pigallery2, not in the actual files) MetadataLoader.mapMetadata(metadata, sidecarData); break; } @@ -363,6 +364,7 @@ export class MetadataLoader { } private static mapTimestampAndOffset(metadata: PhotoMetadata, exif: any) { + //This method looks for date tags matching the priorized list 'DateTags' of 'MetadataCreationDate' let ts: string, offset: string; for (let i = 0; i < DateTags.length; i++) { const [mainpath, extrapath, extratype] = DateTags[i];