use stat_mtime for gen hash (as moving a file does not change content) AND for fall-back date/time of importing a photo -- Fixes BUG-72

This commit is contained in:
2021-10-10 21:12:52 +11:00
parent 2030c8f56e
commit 8f4eb870bb
2 changed files with 2 additions and 4 deletions

View File

@@ -1128,7 +1128,7 @@ def GetDateFromFile(file, stat):
check2 = datetime( year, month, day )
# give up and use file sys date
except:
year, month, day, _, _, _, _, _, _ = datetime.fromtimestamp(stat.st_ctime).timetuple()
year, month, day, _, _, _, _, _, _ = datetime.fromtimestamp(stat.st_mtime).timetuple()
c=date(year, month, day).isocalendar()
woy=c[1]
return year, month, day, woy
@@ -1349,7 +1349,7 @@ def GenHashAndThumb(job, e):
if job.current_file_num % 100 == 0:
session.commit()
stat = os.stat( e.FullPathOnFS() )
if stat.st_ctime < e.file_details.last_hash_date:
if stat.st_mtime < e.file_details.last_hash_date:
if DEBUG:
print(f"OPTIM: GenHashAndThumb {e.name} file is older than last hash, skip this")
job.current_file_num+=1