Add 60s tolerance when compare date_original, date_filename and

date_created
This commit is contained in:
Cédric Leporcq 2022-07-19 21:45:11 +02:00
parent 34e58d6a0f
commit 22e87223a3
1 changed files with 19 additions and 15 deletions

View File

@ -370,18 +370,20 @@ class Media(ReadExif):
file_modify_date = self.metadata['file_modify_date'] file_modify_date = self.metadata['file_modify_date']
if self.metadata['date_original']: if self.metadata['date_original']:
if date_filename and date_filename != date_original: if date_filename and date_filename != date_original:
self.log.warning( timedelta = abs(date_original - date_filename)
f"{filename} time mark is different from {date_original}" if timedelta.total_seconds() > 60:
) self.log.warning(
if self.interactive: f"{filename} time mark is different from {date_original}"
# Ask for keep date taken, filename time, or neither )
choices = [ if self.interactive:
(f"date original:'{date_original}'", date_original), # Ask for keep date taken, filename time, or neither
(f"date filename:'{date_filename}'", date_filename), choices = [
("custom", None), (f"date original:'{date_original}'", date_original),
] (f"date filename:'{date_filename}'", date_filename),
default = f'{date_original}' ("custom", None),
return self._get_date_media_interactive(choices, default) ]
default = f'{date_original}'
return self._get_date_media_interactive(choices, default)
return self.metadata['date_original'] return self.metadata['date_original']
@ -392,9 +394,11 @@ class Media(ReadExif):
f"use date from filename:{date_filename} for {self.file_path}" f"use date from filename:{date_filename} for {self.file_path}"
) )
if date_created and date_filename > date_created: if date_created and date_filename > date_created:
self.log.warning( timedelta = abs(date_created - date_filename)
f"{filename} time mark is more recent than {date_created}" if timedelta.total_seconds() > 60:
) self.log.warning(
f"{filename} time mark is more recent than {date_created}"
)
return date_created return date_created
if self.interactive: if self.interactive: