diff --git a/pa_job_manager.py b/pa_job_manager.py index b311737..8b26b20 100644 --- a/pa_job_manager.py +++ b/pa_job_manager.py @@ -1128,6 +1128,7 @@ def GetDateFromFile(file, stat): check2 = datetime( year, month, day ) # give up and use file sys date except: + # use mtime - probably best to based date from when the content was created/changed year, month, day, _, _, _, _, _, _ = datetime.fromtimestamp(stat.st_mtime).timetuple() c=date(year, month, day).isocalendar() woy=c[1] @@ -1206,6 +1207,7 @@ def JobImportDir(job): fname=dir.PathOnFS()+'/'+basename 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 DEBUG: 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: session.commit() 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 DEBUG: print(f"OPTIM: GenHashAndThumb {e.name} file is older than last hash, skip this")