From 23f79d92df3b141cd12440bdcb82c0ffc19c618f Mon Sep 17 00:00:00 2001 From: Tykayn Date: Fri, 15 Sep 2023 09:20:36 +0200 Subject: [PATCH] remove usage of CreateDate --- utils/finder.ts | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/utils/finder.ts b/utils/finder.ts index 887debd..b6c7ab6 100644 --- a/utils/finder.ts +++ b/utils/finder.ts @@ -103,6 +103,10 @@ export default class finder { log.info(' ... chercher la date de création : "' + structureForFile.freeText + '"') log.debug('data', data) let foundDate = this.findEarliestDateInExifData(data) + let gpsData = this.findGpsCoordinates(data) + if (gpsData) { + structureForFile.tags.push('has-gps') + } log.info(' =>>>>>>> foundDate : ', foundDate) if (foundDate) { @@ -203,31 +207,31 @@ export default class finder { /** * restauration de typologie de nom de fichier gopro pour faciliter les assemblages. */ - if(this.mini_arguments['gopro-restore-name']){ + if (this.mini_arguments['gopro-restore-name']) { this.mini_arguments['remove-timestamp'] = true; this.mini_arguments['remove-tags'] = true; } - if(this.mini_arguments['remove-tags'] ){ + if (this.mini_arguments['remove-tags']) { tagPlace = ''; } - if(this.mini_arguments['remove-timestamp'] ){ + if (this.mini_arguments['remove-timestamp']) { timestampFormatted = ''; } - if(this.mini_arguments['remove-freetext'] ){ - log.debug('override remove-freetext' ) + if (this.mini_arguments['remove-freetext']) { + log.debug('override remove-freetext') rangement_instance.keepFreeText = false; } let extension = fileProperties.extension.trim(); - if(this.mini_arguments['remove-extension'] ){ + if (this.mini_arguments['remove-extension']) { extension = ''; } let spacer = ''; - if (timestampFormatted && fileProperties.freeText && rangement_instance.keepFreeText ) { + if (timestampFormatted && fileProperties.freeText && rangement_instance.keepFreeText) { spacer = ' ' } @@ -486,6 +490,14 @@ export default class finder { } + static findGpsCoordinates(exifData: any) { + let result = null; + if (exifData && exifData.GPSDateTime) { + result = exifData.GPSDateTime + } + return result + } + /** * finds the earliest part in several exif date info * @param exifData @@ -533,8 +545,9 @@ export default class finder { moments.push(exifData.FileModificationDateTime) } if (exifData.CreateDate) { - log.debug(' finder - image créée le : CreateDate : ', exifData.CreateDate) - moments.push(exifData.CreateDate) + // donne des dates trop anciennes par rapport à la réalité + // log.debug(' finder - image créée le : CreateDate : ', exifData.CreateDate) + // moments.push(exifData.CreateDate) } moments = moments.map(d => {