fixed BUG-54/55, viewer now works in PROD, current_file being set in run_ai_on job, added "new" bug-53 re video fname not being set properly when next/prev in viewer

This commit is contained in:
2021-09-14 17:56:06 +10:00
parent 14950e2f02
commit 301b3d220b
5 changed files with 10 additions and 19 deletions

3
BUGs
View File

@@ -1,4 +1,3 @@
### Next: 56
BUG-52: updated tag on person, and it said successful, but the colour was red/danger
BUG-54: URL for viewing image/video is broken in Prod, reference mara:5000 rather than rel path... (might need a ../ ?)
BUG-55: current file in run_ai_on is not being set...
BUG-53: when viewing list, moving to a video and the name of the file is not updated (are there 2 in the dom?)

3
TODO
View File

@@ -1,8 +1,7 @@
## GENERAL
* get build process to create a random string for secret for PROD, otherwise use builtin for dev
* lighthouse -> leverage this for cache control for static...
https://www.kite.com/python/docs/flask.Flask.get_send_file_max_age
* lighthouse -> check in PROD, all ssl / viewer works?
* comment your code
* html files?

View File

@@ -153,7 +153,7 @@ function ViewImageOrVideo()
{
if( objs[current].type == 'Image' )
{
im.src='http://mara.ddp.net:5000/' + objs[current].url
im.src='../' + objs[current].url
$('#video').hide()
$('#vid-caption').hide()
$('#figure').show()
@@ -162,7 +162,7 @@ function ViewImageOrVideo()
}
if( objs[current].type == 'Video' )
{
$('#video').prop('src', 'http://mara.ddp.net:5000/' + objs[current].url )
$('#video').prop('src', '../' + objs[current].url )
$('#figure').hide()
$('#video').show()
$('#vid-caption').show()

View File

@@ -591,7 +591,6 @@ def AddLogForJob(job, message):
if hasattr(job, 'last_commit'):
if (now - job.last_commit).seconds > 5:
job.last_commmit=now
print( "DELME: we have taken longer than 5 seconds since last commit so do it")
session.commit()
else:
job.last_commit = now
@@ -1215,11 +1214,7 @@ def RunFuncOnFilesInPath( job, path, file_func, count_dirs ):
####################################################################################################################################
def WrapperForScanFileForPerson(job, entry):
if entry.type.name == 'Image':
if DEBUG:
AddLogForJob( job, f'INFO: processing File: {entry.name}' )
ScanFileForPerson( job, entry, force=False)
# processed this file, add 1 to count
job.current_file_num+=1
return
####################################################################################################################################
@@ -1271,8 +1266,6 @@ def JobRunAIOn(job):
elif entry.type.name == 'Image':
which_file=session.query(Entry).join(File).filter(Entry.id==jex.value).first()
ScanFileForPerson( job, which_file, force=False)
# processed this file, add 1 to count
job.current_file_num+=1
else:
AddLogForJob( job, f'Not processing Entry: {entry.name} - not an image' )
FinishJob(job, "Finished Processesing AI")
@@ -1746,8 +1739,8 @@ def ScanFileForPerson( job, e, force=False ):
model=session.query(AIModel).get(settings.default_scan_model)
threshold = settings.default_threshold
if DEBUG:
AddLogForJob( job, f'INFO: processing File: {e.name} and threshold face distance of {threshold}' )
# add log, set current_file and increment file_num in job
ProcessFileForJob( job, f'INFO: processing File: {e.name} and threshold face distance of {threshold}', e.name )
file_h = session.query(File).get( e.id )
# if we are forcing this, delete any old faces (this will also delete linked tables), and reset faces_created_on to None
if force:

View File

@@ -29,8 +29,8 @@
{% for id in objs %}
e=new Object()
e.name = "{{objs[id].name}}"
e.url = "{{objs[id].FullPathOnFS()}}"
e.name = "{{objs[id].name|safe}}"
e.url = "{{objs[id].FullPathOnFS()|safe}}"
e.type = "{{objs[id].type.name}}"
{% if objs[id].file_details.faces %}
e.face_model="{{objs[id].file_details.faces[0].facefile_lnk.model_used}}"
@@ -113,7 +113,7 @@
<script>
var im=new Image();
im.onload=DrawImg
im.src="http://mara.ddp.net:5000/" + objs[current].url
im.src="../" + objs[current].url
var context = canvas.getContext('2d')
window.addEventListener('resize', DrawImg, false);
</script>
@@ -124,7 +124,7 @@
{% endif %}
<div class="col col-auto">
<video id="video" class="col col-auto" controls>
<source src="http://mara.ddp.net:5000/{{objs[current].FullPathOnFS()}}" type="video/mp4">
<source src="../{{objs[current].FullPathOnFS()}}" type="video/mp4">
Your browser does not support the video tag.
</video>
<figcaption id="vid-caption" class="figure-caption text-center text-wrap text-break"><span id="fname">{{objs[current].name}}</span></figcaption>