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

2
BUGs
View File

@@ -6,5 +6,3 @@ BUG-61: in Fullscreen mode and next/prev dropped out of FS when calling /viewlis
-- then we can stay on-page, and stay in FS and then just call ViewImageOrVide()
BUG-69: when moving a directory (maybe files???) it creates new destination directory even if one exists... not sure what the os.replace, etc. does at that point???
BUG-70: when a dir is a match and a file is a match (common with our date-based matching), then we get 2 answers in the search
BUG-72: when re-scanning import dir, I always regen hash for 20201225_181843.jpg - why?
-- also happened for a lot of storage photos, see job: 909

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