wrapped ProcessFilesInDir to just take a job, path, file_func to run, updated TODOs appropriately - added sql for duplicates check to TODO
This commit is contained in:
@@ -527,6 +527,12 @@ def JobImportDir(job):
|
||||
session.commit()
|
||||
return
|
||||
|
||||
def RunFuncOnFilesInPath( job, path, file_func ):
|
||||
d=session.query(Dir).filter(Dir.path_prefix==path).first()
|
||||
for e in d.files:
|
||||
ProcessFilesInDir(job, e, file_func)
|
||||
|
||||
|
||||
def JobProcessAI(job):
|
||||
path=[jex.value for jex in job.extra if jex.name == "path"][0]
|
||||
path = SymlinkName(path, '/')
|
||||
@@ -537,14 +543,11 @@ def JobProcessAI(job):
|
||||
for person in people:
|
||||
generateKnownEncodings(person)
|
||||
|
||||
for e in FilesInDir( path ):
|
||||
ProcessFilesInDir(job, e, ProcessAI)
|
||||
RunFuncOnFilesInPath( job, path, ProcessAI )
|
||||
|
||||
FinishJob(job, "Finished Processesing AI")
|
||||
return
|
||||
|
||||
def FilesInDir( path ):
|
||||
d=session.query(Dir).filter(Dir.path_prefix==path).first()
|
||||
return d.files
|
||||
|
||||
def GenHashAndThumb(job, e):
|
||||
stat = os.stat( e.in_dir[0].path_prefix + '/' + e.name )
|
||||
@@ -678,8 +681,7 @@ def JobGetFileDetails(job):
|
||||
job.current_file_num = 0
|
||||
job.num_files = dir.num_files
|
||||
session.commit()
|
||||
for e in FilesInDir( path ):
|
||||
ProcessFilesInDir(job, e, GenHashAndThumb )
|
||||
RunFuncOnFilesInPath( job, path, GenHashAndThumb )
|
||||
FinishJob(job, "File Details job finished")
|
||||
session.commit()
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user