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 ### Next: 56
BUG-52: updated tag on person, and it said successful, but the colour was red/danger 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-53: when viewing list, moving to a video and the name of the file is not updated (are there 2 in the dom?)
BUG-55: current file in run_ai_on is not being set...

3
TODO
View File

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

View File

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

View File

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

View File

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