add lower and strict year to search

This commit is contained in:
Tykayn 2024-01-02 21:54:58 +01:00 committed by tykayn
parent 9a65f2fb7e
commit 051d029c30

View File

@ -268,6 +268,9 @@ export default class finder {
if (this.mini_arguments['lowerYear']) {
log.info('année minimale à retenir pour la sélection des dates:', this.mini_arguments['lowerYear'])
}
if (this.mini_arguments['strictYear']) {
log.info('année à retenir pour la sélection des dates:', this.mini_arguments['lowerYear'])
}
if (!this.mini_arguments._.length) {
log.info('pas de fichier ou de dossier demandé, veuillez spécifier un chemin en argument')
}
@ -520,14 +523,14 @@ export default class finder {
console.log('(year > 1970)', (year > 1970))
let lowerYearPossible = this.mini_arguments['lowerYear']
let strictYearToFind = 1 * this.mini_arguments['strictYear']
let lowerYearPossible = 1 * this.mini_arguments['lowerYear']
if (!lowerYearPossible) {
lowerYearPossible = 2004
}
let today: Date = new Date();
let higherYearPossible = today.getFullYear()
let isDateGood = (year >= lowerYearPossible) && (year <= higherYearPossible)
let isDateGood = (year === strictYearToFind) || ((year >= lowerYearPossible) && (year <= higherYearPossible))
console.log('lowerYearPossible', lowerYearPossible)
if (!isDateGood) {
log.warn(' date is not good :', date)
@ -549,6 +552,8 @@ export default class finder {
static findEarliestDateInExifData(exifData: any) {
log.debug(' finder - findEarliestDateInExifData')
this.moments = []
if (exifData) {
let exifDates: string[] = ['DateTimeOriginal', 'FileModificationDateTime', 'FileModificationDate', 'ModificationDateTime', 'ModifyDate', 'FileAccessDateTime', 'DateTime', 'FileInodeChangeDateTime', 'CreateDate']