fix BUG-107: view / pagination gets out of whack
This commit is contained in:
3
BUGs
3
BUGs
@@ -1,7 +1,6 @@
|
|||||||
### Next: 107
|
### Next: 108
|
||||||
BUG-100: I managed to get 2 photos matching mich in the NOT_WORKING photo (probably dif refimgs but same p.tag?)
|
BUG-100: I managed to get 2 photos matching mich in the NOT_WORKING photo (probably dif refimgs but same p.tag?)
|
||||||
BUG-105: show unmatched needs to handle overrides (ignore face, etc.)
|
BUG-105: show unmatched needs to handle overrides (ignore face, etc.)
|
||||||
BUG-106: cant add trudy /pat? as refimgs via FaceDBox
|
BUG-106: cant add trudy /pat? as refimgs via FaceDBox
|
||||||
- seems the cropped trudy face is not sufficient to find a face, how odd...
|
- seems the cropped trudy face is not sufficient to find a face, how odd...
|
||||||
(it came from a face bbox, BUT, I have grown the face seln by 10%?)
|
(it came from a face bbox, BUT, I have grown the face seln by 10%?)
|
||||||
BUG-107: view / pagination gets out of whack - suss its paging in, then a new scan resets file/ordering (offset most likely?)
|
|
||||||
|
|||||||
@@ -982,9 +982,9 @@ def DisconnectSingleNoMatchOverride( job, o ):
|
|||||||
session.add( DisconnectedNoMatchOverride( face=f.face, type_id=o.type_id ) )
|
session.add( DisconnectedNoMatchOverride( face=f.face, type_id=o.type_id ) )
|
||||||
|
|
||||||
# now deal with 'renaming' the metadata on FS
|
# now deal with 'renaming' the metadata on FS
|
||||||
p=f'{SettingsMPath()}/no_match_overrides/'
|
mpath=f'{SettingsMPath()}/no_match_overrides/'
|
||||||
fname=f'{p}{o.face_id}_{ot.name}'
|
fname=f'{mpath}{o.face_id}_{ot.name}'
|
||||||
new_fname=f'{p}0_{ot.name}_{uuid.uuid4()}'
|
new_fname=f'{mpath}0_{ot.name}_{uuid.uuid4()}'
|
||||||
try:
|
try:
|
||||||
if os.path.exists( fname ):
|
if os.path.exists( fname ):
|
||||||
os.replace( fname, new_fname )
|
os.replace( fname, new_fname )
|
||||||
@@ -1581,6 +1581,18 @@ def find_last_successful_ai_scan(job):
|
|||||||
return j.last_update.timestamp()
|
return j.last_update.timestamp()
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
####################################################################################################################################
|
||||||
|
# when an import job actually finds new files, then the pa_user_state caches will become invalid (offsets are now wrong)
|
||||||
|
####################################################################################################################################
|
||||||
|
def DeleteOldPA_UserState(job):
|
||||||
|
# clear them out for now - this is 'dumb', just delete ALL. Eventually, can do this based on just the path &/or whether the last_used is
|
||||||
|
# newer than this delete moment (only would be a race condition between an import changing things and someone simultaneously viewing)
|
||||||
|
# path=[jex.value for jex in job.extra if jex.name == "path"][0]
|
||||||
|
session.query(PA_UserState).delete()
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
####################################################################################################################################
|
####################################################################################################################################
|
||||||
# JobImportDir(): job that scan import dir and processes entries in there - key function that uses os.walk() to traverse the
|
# JobImportDir(): job that scan import dir and processes entries in there - key function that uses os.walk() to traverse the
|
||||||
# file system and calls AddFile()/AddDir() as necessary
|
# file system and calls AddFile()/AddDir() as necessary
|
||||||
@@ -1689,6 +1701,8 @@ def JobImportDir(job):
|
|||||||
if found_new_files:
|
if found_new_files:
|
||||||
job.extra.append( JobExtra( name="new_files", value=found_new_files ) )
|
job.extra.append( JobExtra( name="new_files", value=found_new_files ) )
|
||||||
session.add(job)
|
session.add(job)
|
||||||
|
# this will invalidate pa_user_state for this path's contents (offsets are now wrong), clear them out
|
||||||
|
DeleteOldPA_UserState(job)
|
||||||
|
|
||||||
rm_cnt=HandleAnyFSDeletions(job)
|
rm_cnt=HandleAnyFSDeletions(job)
|
||||||
|
|
||||||
@@ -2206,8 +2220,8 @@ def ReloadMetadata(job):
|
|||||||
AddLogForJob(job, f"INFO: Loading/Retrieving any Metatdata...")
|
AddLogForJob(job, f"INFO: Loading/Retrieving any Metatdata...")
|
||||||
|
|
||||||
# no path, then no metadata (probably first ever run)
|
# no path, then no metadata (probably first ever run)
|
||||||
p = SettingsMPath()
|
mpath = SettingsMPath()
|
||||||
if not p:
|
if not mpath:
|
||||||
FinishJob( job, "No metadata path - skipping" )
|
FinishJob( job, "No metadata path - skipping" )
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@@ -2215,7 +2229,7 @@ def ReloadMetadata(job):
|
|||||||
CopyOverrides()
|
CopyOverrides()
|
||||||
|
|
||||||
# process Metadata on FS for no_match_overrides (disco ones, will have 0 as face_id)
|
# process Metadata on FS for no_match_overrides (disco ones, will have 0 as face_id)
|
||||||
fnames = glob.glob( f'{p}/no_match_overrides/*' )
|
fnames = glob.glob( f'{mpath}/no_match_overrides/*' )
|
||||||
for fname in fnames:
|
for fname in fnames:
|
||||||
# type derived from fname (e.g. 0_Too Young_uuid*, 1_Too Young, 2_Ingore Face, etc.)
|
# type derived from fname (e.g. 0_Too Young_uuid*, 1_Too Young, 2_Ingore Face, etc.)
|
||||||
match=re.search( '(\d+)_([^_\.]+)', fname )
|
match=re.search( '(\d+)_([^_\.]+)', fname )
|
||||||
@@ -2234,12 +2248,12 @@ def ReloadMetadata(job):
|
|||||||
session.add( DisconnectedNoMatchOverride( face=face_data, type_id=otype.id ) )
|
session.add( DisconnectedNoMatchOverride( face=face_data, type_id=otype.id ) )
|
||||||
if face_id:
|
if face_id:
|
||||||
try:
|
try:
|
||||||
os.replace( fname, f'{p}no_match_overrides/0_{otype.name}_{uuid.uuid4()}' )
|
os.replace( fname, f'{mpath}no_match_overrides/0_{otype.name}_{uuid.uuid4()}' )
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
print( f"ERROR: renaming no-match metadata on filesystem failed: {ex}" )
|
print( f"ERROR: renaming no-match metadata on filesystem failed: {ex}" )
|
||||||
|
|
||||||
# process Metadata on FS for force_match_overrides (disco ones, will have 0 as face_id)
|
# process Metadata on FS for force_match_overrides (disco ones, will have 0 as face_id)
|
||||||
fnames = glob.glob( f'{p}force_match_overrides/*' )
|
fnames = glob.glob( f'{mpath}force_match_overrides/*' )
|
||||||
for fname in fnames:
|
for fname in fnames:
|
||||||
# person derived from fname (e.g. 0_ddp_uuid*, 1_ddp, 2_mich, etc.)
|
# person derived from fname (e.g. 0_ddp_uuid*, 1_ddp, 2_mich, etc.)
|
||||||
match=re.search( '(\d+)_([^_]+)', fname )
|
match=re.search( '(\d+)_([^_]+)', fname )
|
||||||
@@ -2262,7 +2276,7 @@ def ReloadMetadata(job):
|
|||||||
# if face>0, then we need to move the FS copy to a disco
|
# if face>0, then we need to move the FS copy to a disco
|
||||||
if face_id:
|
if face_id:
|
||||||
try:
|
try:
|
||||||
os.replace( fname, f'{p}force_match_overrides/0_{p.tag}_{uuid.uuid4()}' )
|
os.replace( fname, f'{mpath}force_match_overrides/0_{p.tag}_{uuid.uuid4()}' )
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
print( f"ERROR: renaming force-match metadata on filesystem failed: {ex}" )
|
print( f"ERROR: renaming force-match metadata on filesystem failed: {ex}" )
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user