1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2024-12-23 01:27:14 +02:00

A few extra comments added

This commit is contained in:
gras 2024-04-18 21:00:51 +02:00
parent 7dd09100d4
commit dca5f2a9d6
2 changed files with 7 additions and 2 deletions

View File

@ -1,10 +1,13 @@
//The elements are [tag-name1, tag-name2, type of tag-name2] //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: //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 //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][] = [ export const DateTags: [string, string, string][] = [
// Date tag Offset or time tag Type //Description // 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 ["exif.DateTimeOriginal", "exif.OffsetTimeOriginal", 'O'], //Date and time when the original image was taken - shutter close time

View File

@ -249,6 +249,7 @@ export class MetadataLoader {
if (fs.existsSync(sidecarPath)) { if (fs.existsSync(sidecarPath)) {
const sidecarData: any = await exifr.sidecar(sidecarPath, exifrOptions); const sidecarData: any = await exifr.sidecar(sidecarPath, exifrOptions);
if (sidecarData !== undefined) { 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); MetadataLoader.mapMetadata(metadata, sidecarData);
break; break;
} }
@ -363,6 +364,7 @@ export class MetadataLoader {
} }
private static mapTimestampAndOffset(metadata: PhotoMetadata, exif: any) { 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; let ts: string, offset: string;
for (let i = 0; i < DateTags.length; i++) { for (let i = 0; i < DateTags.length; i++) {
const [mainpath, extrapath, extratype] = DateTags[i]; const [mainpath, extrapath, extratype] = DateTags[i];