started hooking up right-click menu for Dir and Files all the way through to calling the new ScanFileForPerson() - which is still incomplete but does use the new Faces DB linkages and functions
This commit is contained in:
@@ -137,9 +137,13 @@ class Entry(Base):
|
||||
in_dir = relationship ("Dir", secondary="entry_dir_link", uselist=False )
|
||||
|
||||
def FullPathOnFS(self):
|
||||
s=self.in_dir.in_path.path_prefix + '/'
|
||||
if len(self.in_dir.rel_path) > 0:
|
||||
s += self.in_dir.rel_path + '/'
|
||||
if self.in_dir:
|
||||
s=self.in_dir.in_path.path_prefix + '/'
|
||||
if len(self.in_dir.rel_path) > 0:
|
||||
s += self.in_dir.rel_path + '/'
|
||||
# this occurs when we have a dir that is the root of a path
|
||||
else:
|
||||
s=self.dir_details.in_path.path_prefix+'/'
|
||||
s += self.name
|
||||
return s
|
||||
|
||||
@@ -431,6 +435,8 @@ def RunJob(job):
|
||||
JobRestoreFiles(job)
|
||||
elif job.name == "processai":
|
||||
JobProcessAI(job)
|
||||
elif job.name == "run_ai_on":
|
||||
JobRunAIOn(job)
|
||||
else:
|
||||
print("ERROR: Requested to process unknown job type: {}".format(job.name))
|
||||
# okay, we finished a job, so check for any jobs that are dependant on this and run them...
|
||||
@@ -940,6 +946,44 @@ def JobProcessAI(job):
|
||||
FinishJob(job, "Finished Processesing AI")
|
||||
return
|
||||
|
||||
def WrapperForScanFileForPerson(job, entry):
|
||||
which_person=[jex.value for jex in job.extra if jex.name == "person"][0]
|
||||
if which_person == "all":
|
||||
ppl=session.query(Person).all()
|
||||
else:
|
||||
ppl=session.query(Person).filter(Person.tag==which_person).all()
|
||||
for person in ppl:
|
||||
print( f"(wrapper) call == ScanFileForPerson( {entry.id}, {person.id}, force=False )" )
|
||||
return
|
||||
|
||||
def JobRunAIOn(job):
|
||||
AddLogForJob(job, f"INFO: Starting looking For faces in files job...")
|
||||
which_person=[jex.value for jex in job.extra if jex.name == "person"][0]
|
||||
if which_person == "all":
|
||||
ppl=session.query(Person).all()
|
||||
else:
|
||||
ppl=session.query(Person).filter(Person.tag==which_person).all()
|
||||
print( "JobRunAIOn() called" )
|
||||
for person in ppl:
|
||||
print( f"person={person.tag}" )
|
||||
|
||||
for jex in job.extra:
|
||||
if 'eid-' in jex.name:
|
||||
entry=session.query(Entry).get(jex.value)
|
||||
print( f'en={entry}' )
|
||||
if entry.type.name == 'Directory':
|
||||
ProcessFilesInDir( job, entry, WrapperForScanFileForPerson )
|
||||
elif entry.type.name == 'Image':
|
||||
which_file=session.query(Entry).join(File).filter(Entry.id==jex.value).first()
|
||||
print( f"JobRunAIOn: file to process had id: {which_file.id}" )
|
||||
for person in ppl:
|
||||
print( f"call == ScanFileForPerson( {which_file.id}, {person.id}, force=False )" )
|
||||
else:
|
||||
AddLogForJob( job, f'Not processing Entry: {entry.name} - not an image' )
|
||||
print(" HARD EXITING to keep testing " )
|
||||
exit( -1 )
|
||||
FinishJob(job, "Finished Processesing AI")
|
||||
return
|
||||
|
||||
def GenHashAndThumb(job, e):
|
||||
# commit every 100 files to see progress being made but not hammer the database
|
||||
@@ -1056,6 +1100,7 @@ def compareAI(known_encoding, unknown_encoding):
|
||||
|
||||
def ProcessFilesInDir(job, e, file_func):
|
||||
if DEBUG==1:
|
||||
print( f"???? e={e}" )
|
||||
print( f"DEBUG: ProcessFilesInDir: {e.FullPathOnFS()}")
|
||||
if e.type.name != 'Directory':
|
||||
file_func(job, e)
|
||||
|
||||
Reference in New Issue
Block a user