added small spaces before first row of images to stop squishing into navbar, added flipping / made that work, and now show thumbnail after rotation/flip is finished - all works, and removed debugs
This commit is contained in:
5
TODO
5
TODO
@@ -1,10 +1,5 @@
|
||||
## GENERAL
|
||||
|
||||
* file browser:
|
||||
- maybe back feature/button?
|
||||
|
||||
* allow rotate of image (permanently on FS, so its right everywhere)
|
||||
|
||||
* face locations:
|
||||
START FORM SCRATCH so all images have face_locn data
|
||||
right now GenThumb is in shared, and does width, height as well --> in person.py BUT need this for pa_job_manager
|
||||
|
||||
@@ -450,6 +450,8 @@ def RunJob(job):
|
||||
JobProcessAI(job)
|
||||
elif job.name == "run_ai_on":
|
||||
JobRunAIOn(job)
|
||||
elif job.name == "rotate_image":
|
||||
JobRotateImage(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...
|
||||
@@ -973,7 +975,6 @@ def AddToJobImageCount(job, entry ):
|
||||
job.num_files += 1
|
||||
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]
|
||||
@@ -1021,7 +1022,31 @@ def JobRunAIOn(job):
|
||||
AddLogForJob( job, f'Not processing Entry: {entry.name} - not an image' )
|
||||
FinishJob(job, "Finished Processesing AI")
|
||||
return
|
||||
|
||||
|
||||
def JobRotateImage(job):
|
||||
AddLogForJob(job, f"INFO: Starting rotation/flip of image file...")
|
||||
id=[jex.value for jex in job.extra if jex.name == "id"][0]
|
||||
amt=[jex.value for jex in job.extra if jex.name == "amt"][0]
|
||||
e=session.query(Entry).join(File).filter(Entry.id==id).first()
|
||||
im = Image.open( e.FullPathOnFS() )
|
||||
|
||||
print(amt)
|
||||
|
||||
if amt == "fliph":
|
||||
AddLogForJob(job, f"INFO: Flipping {e.FullPathOnFS()} horizontally" )
|
||||
out = im.transpose(Image.FLIP_LEFT_RIGHT)
|
||||
elif amt == "flipv":
|
||||
AddLogForJob(job, f"INFO: Flipping {e.FullPathOnFS()} vertically" )
|
||||
out = im.transpose(Image.FLIP_TOP_BOTTOM)
|
||||
else:
|
||||
AddLogForJob(job, f"INFO: Rotating {e.FullPathOnFS()} by {amt} degrees" )
|
||||
out = im.rotate(int(amt), expand=True)
|
||||
out.save( e.FullPathOnFS() )
|
||||
e.file_details.thumbnail = GenThumb( e.FullPathOnFS() )
|
||||
session.add(e)
|
||||
FinishJob(job, "Finished Processesing image rotation/flip")
|
||||
return
|
||||
|
||||
def GenHashAndThumb(job, e):
|
||||
# commit every 100 files to see progress being made but not hammer the database
|
||||
if job.current_file_num % 100 == 0:
|
||||
@@ -1302,13 +1327,10 @@ def RemoveDups(job):
|
||||
|
||||
def JobMoveFiles(job):
|
||||
AddLogForJob(job, f"INFO: Starting Move Files job...")
|
||||
AddLogForJob(job, f"INFO: NOT PROCESSING THIS - TESTING...")
|
||||
prefix=[jex.value for jex in job.extra if jex.name == "prefix"][0]
|
||||
suffix=[jex.value for jex in job.extra if jex.name == "suffix"][0]
|
||||
storage_rp=[jex.value for jex in job.extra if jex.name == "storage_rp"][0]
|
||||
print( f"storage_rp={storage_rp}" )
|
||||
dst_storage_path = session.query(Path).filter(Path.path_prefix=='static/Storage/'+ storage_rp).first()
|
||||
print( f"dsp={dst_storage_path}" )
|
||||
for jex in job.extra:
|
||||
if 'eid-' in jex.name:
|
||||
move_me=session.query(Entry).join(File).filter(Entry.id==jex.value).first()
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
{% if search_term is defined %}
|
||||
<input type="hidden" name="term" id="view_term" value="{{search_term}}">
|
||||
{% endif %}
|
||||
<div class="row">
|
||||
<div class="row mb-2">
|
||||
{% if folders %}
|
||||
<div class="mx-3 my-auto">
|
||||
<span class="alert alert-primary">
|
||||
@@ -347,8 +347,6 @@ var attempt=0;
|
||||
|
||||
function CheckRotateJob(id,job_id)
|
||||
{
|
||||
console.log( 'CheckRotateJob: ' + id + ', ' + job_id )
|
||||
{# TODO: all the code except for the SetTimeout to be replaced with a post / check response from f/e #}
|
||||
$.ajax(
|
||||
{
|
||||
type: 'POST', data: '&job_id='+job_id, url: '/checkrotatejob', success: function(data) {
|
||||
@@ -357,6 +355,7 @@ function CheckRotateJob(id,job_id)
|
||||
$('#s'+id).hide()
|
||||
$('#'+id).find('img.thumb').attr('style', 'filter: color(100%);' );
|
||||
$('#'+id).addClass('entry')
|
||||
$('#'+id).find('.thumb').attr('src', 'data:image/jpeg;base64,'+data.thumbnail)
|
||||
return false;
|
||||
}
|
||||
else
|
||||
@@ -369,7 +368,6 @@ function CheckRotateJob(id,job_id)
|
||||
|
||||
function Rotate(amt)
|
||||
{
|
||||
console.log('rotate: '+amt)
|
||||
$('.highlight').each(function( id, e ) {
|
||||
post_data = '&amt='+amt+'&id='+e.id
|
||||
{# send rotate for this image, grayscale the thumbmail, add color spinning wheel overlay, and start checking for job end #}
|
||||
@@ -416,7 +414,7 @@ function MoveDBox()
|
||||
<br>
|
||||
<div class="form-row col-lg-12">
|
||||
<button onClick="$('#dbox').modal('hide'); return false;" class="btn btn-outline-secondary offset-lg-1 col-lg-2">Cancel</button>
|
||||
<button onClick="$('#dbox').modal('hide'); console.log("TODO: should do the move one day"); return false;" class="btn btn-outline-primary col-lg-2">Ok</button>
|
||||
<button onClick="$('#dbox').modal('hide'); return false;" class="btn btn-outline-primary col-lg-2">Ok</button>
|
||||
</div>
|
||||
</form>
|
||||
`
|
||||
@@ -455,7 +453,6 @@ function DoSel(e, el)
|
||||
clicked=Number($(el).attr('ecnt'))
|
||||
if( ! $('#folders').value )
|
||||
{
|
||||
console.log( 'out by 1 because flat view' )
|
||||
st -= 1
|
||||
end -= 1
|
||||
clicked -= 1
|
||||
@@ -565,7 +562,9 @@ $.contextMenu({
|
||||
items: {
|
||||
"r90": { "name" : "90 degrees" },
|
||||
"r180": { "name" : "180 degrees" },
|
||||
"r270": { "name" : "270 degrees" }
|
||||
"r270": { "name" : "270 degrees" },
|
||||
"fliph": { "name" : "flip horizontally" },
|
||||
"flipv": { "name" : "flip vertically" }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -609,6 +608,8 @@ $.contextMenu({
|
||||
if( key == "r90" ) { Rotate(90) }
|
||||
if( key == "r180" ) { Rotate(180) }
|
||||
if( key == "r270" ) { Rotate(270) }
|
||||
if( key == "fliph" ) { Rotate("fliph") }
|
||||
if( key == "flipv" ) { Rotate("flipv") }
|
||||
if( key.startsWith("ai")) { RunAIOnSeln(key) }
|
||||
},
|
||||
items: item_list
|
||||
|
||||
Reference in New Issue
Block a user