comments
This commit is contained in:
@@ -1128,6 +1128,7 @@ def GetDateFromFile(file, stat):
|
|||||||
check2 = datetime( year, month, day )
|
check2 = datetime( year, month, day )
|
||||||
# give up and use file sys date
|
# give up and use file sys date
|
||||||
except:
|
except:
|
||||||
|
# use mtime - probably best to based date from when the content was created/changed
|
||||||
year, month, day, _, _, _, _, _, _ = datetime.fromtimestamp(stat.st_mtime).timetuple()
|
year, month, day, _, _, _, _, _, _ = datetime.fromtimestamp(stat.st_mtime).timetuple()
|
||||||
c=date(year, month, day).isocalendar()
|
c=date(year, month, day).isocalendar()
|
||||||
woy=c[1]
|
woy=c[1]
|
||||||
@@ -1206,6 +1207,7 @@ def JobImportDir(job):
|
|||||||
fname=dir.PathOnFS()+'/'+basename
|
fname=dir.PathOnFS()+'/'+basename
|
||||||
|
|
||||||
stat = os.stat(fname)
|
stat = os.stat(fname)
|
||||||
|
# use ctime as even a metadata change (mv'd file on the fs, or a perms change) needs to be checked
|
||||||
if stat.st_ctime > dir.last_import_date:
|
if stat.st_ctime > dir.last_import_date:
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
print("DEBUG: {} - {} is newer than {}".format( basename, stat.st_ctime, dir.last_import_date ) )
|
print("DEBUG: {} - {} is newer than {}".format( basename, stat.st_ctime, dir.last_import_date ) )
|
||||||
@@ -1349,6 +1351,7 @@ def GenHashAndThumb(job, e):
|
|||||||
if job.current_file_num % 100 == 0:
|
if job.current_file_num % 100 == 0:
|
||||||
session.commit()
|
session.commit()
|
||||||
stat = os.stat( e.FullPathOnFS() )
|
stat = os.stat( e.FullPathOnFS() )
|
||||||
|
# use mtime as only if the content is different do we need to redo the hash
|
||||||
if stat.st_mtime < e.file_details.last_hash_date:
|
if stat.st_mtime < e.file_details.last_hash_date:
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
print(f"OPTIM: GenHashAndThumb {e.name} file is older than last hash, skip this")
|
print(f"OPTIM: GenHashAndThumb {e.name} file is older than last hash, skip this")
|
||||||
|
|||||||
Reference in New Issue
Block a user