From 0bcc85f42b951000ba461b3671d325a880ce65e0 Mon Sep 17 00:00:00 2001 From: Damien De Paoli Date: Fri, 1 Oct 2021 22:16:42 +1000 Subject: [PATCH] remove last remnants of rotate instead of transform, updated rot* svgs to have arrow point in direction of actual rotation, AND, fixed bug where when we rotate an image that has already had an exif_transform on it, then we have to do that and then the requested rotation - fixes why sometimes we rotate say 180 when we intended a 90 rotate. Also, when we transform, recalc md5 as file has changed --- files.py | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/files.py b/files.py index 27144c8..6be56f8 100644 --- a/files.py +++ b/files.py @@ -519,40 +519,37 @@ def view_img(id): face.locn = json.loads(face.locn) return render_template("viewer.html", current=int(id), eids=eids, objs=objs, OPT=OPT ) -# route called from front/end - if multiple images are being rotated, each rotation == a separate call -# to this route (and therefore a separate rotate job. Each reponse allows the f/e to check the -# specific rotation job is finished (/checkrotatejob) which will be called (say) every 1 sec. from f/e -# with a spinning wheel, then when pa_job_mgr has finished it will return the rotated thumb -@app.route("/rotate", methods=["POST"]) +# route called from front/end - if multiple images are being transformed, each transorm == a separate call +# to this route (and therefore a separate transorm job. Each reponse allows the f/e to check the +# specific transorm job is finished (/checktransformjob) which will be called (say) every 1 sec. from f/e +# with a spinning wheel, then when pa_job_mgr has finished it will return the transformed thumb @app.route("/transform", methods=["POST"]) @login_required -def rotate(): +def transform(): id = request.form['id'] amt = request.form['amt'] - print( f"rotate called with id={id}, amt={amt}") + print( f"transform called with id={id}, amt={amt}") jex=[] for el in request.form: jex.append( JobExtra( name=f"{el}", value=request.form[el] ) ) - job=NewJob( "rotate_image", 0, None, jex ) + job=NewJob( "transform_image", 0, None, jex ) resp={} resp['job_id']=job.id - # TODO: make this return data with the job number, then the f/e can poll checkrotatejob return resp ################################################################################ -# /checkrotatejob -> URL that is called repeatedly by front-end waiting for the -# b/e to finish the rotate job. Once done, the new / now -# rotated image's thumbnail is returned so the f/e can +# /checktransformjob -> URL that is called repeatedly by front-end waiting for the +# b/e to finish the transform job. Once done, the new / now +# transformed image's thumbnail is returned so the f/e can # update with it ################################################################################ @app.route("/checktransformjob", methods=["POST"]) -@app.route("/checkrotatejob", methods=["POST"]) @login_required -def checkrotatejob(): +def checktransformjob(): job_id = request.form['job_id'] job = Job.query.get(job_id) resp={}