diff --git a/TODO b/TODO index 640a5ac..f4558dd 100644 --- a/TODO +++ b/TODO @@ -1,10 +1,15 @@ ## GENERAL - * optim to not run_ai_on_* for scan, needs to make sure last run_ai_on actually ran/worked - might have failed (or in my case was marked stale and I cancelled it) + * going forward into search page (and probably all POSTs) does not work + don't render_template instead do a redirect to a GET of the new, or list? for del... + files.py:@app.route("/view/", methods=["POST"]) + job.py:@app.route("/jobs", methods=["GET", "POST"]) + job.py:@app.route("/job/", methods=["GET","POST"]) + files.py:@app.route("/fix_dups", methods=["POST"]) + files.py:@app.route("/viewlist", methods=["POST"]) + -- this will need a total rewrite for viewer to handle fullscreen across offset/size boundaries so fix that instead - * going forward into search page (and probably all POSTs) does not work - no data posted (e.g. no search term) - - okay somehow (maybe cache-control?) is causing flask to handle this and gunicorn does not! - - seems we could make the /search url be /search/term and use a GET, this would make it not run into this issue - - OR, seems we can follow a different pattern... don't render_template instead do a redirect to a GET of the new, or list? for del... + * optim to not run_ai_on_* for scan, needs to make sure last run_ai_on actually ran/worked - might have failed (or in my case was marked stale and I cancelled it) + -- also the case for get file details though, need to make sure last one was completed * per file you could select an unknown face and add it as a ref img to an existing person, or make a new person and attach? * [DONE] order/ find face with largest size and at least show that as unmatched diff --git a/files.py b/files.py index 10f0fff..836bc54 100644 --- a/files.py +++ b/files.py @@ -292,10 +292,13 @@ def clear_jm_msg(id): ################################################################################ # /file_list -> show detailed file list of files from import_path(s) ################################################################################ -@app.route("/file_list_ip", methods=["GET","POST"]) +@app.route("/file_list_ip", methods=["GET", "POST"]) @login_required def file_list_ip(): OPT=Options( request ) + # now we have reset the offset, etc. into the prefs, we can use a GET and this will be back/forward browser button safe + if request.method=='POST': + redirect("/file_list_ip") entries=GetEntries( OPT ) return render_template("file_list.html", page_title='View File Details (Import Path)', entry_data=entries, OPT=OPT ) @@ -306,6 +309,9 @@ def file_list_ip(): @login_required def files_ip(): OPT=Options( request ) + # now we have reset the offset, etc. into the prefs, we can use a GET and this will be back/forward browser button safe + if request.method=='POST': + redirect("/files_ip") entries=GetEntries( OPT ) people = Person.query.all() move_paths = MovePathDetails() @@ -318,6 +324,9 @@ def files_ip(): @login_required def files_sp(): OPT=Options( request ) + # now we have reset the offset, etc. into the prefs, we can use a GET and this will be back/forward browser button safe + if request.method=='POST': + redirect("/files_sp") entries=GetEntries( OPT ) people = Person.query.all() move_paths = MovePathDetails() @@ -331,6 +340,9 @@ def files_sp(): @login_required def files_rbp(): OPT=Options( request ) + # now we have reset the offset, etc. into the prefs, we can use a GET and this will be back/forward browser button safe + if request.method=='POST': + redirect("/files_rbp") entries=GetEntries( OPT ) people = Person.query.all() move_paths = MovePathDetails() @@ -404,7 +416,7 @@ def fix_dups(): if rows.returns_rows == False: st.SetMessage(f"Err, no dups - should now clear the FE 'danger' message?") - return render_template("base.html") + return redirect("/") if 'pagesize' not in request.form: # default to 10, see if we have a larger value as someone reset it in the gui, rather than first time invoked @@ -448,7 +460,7 @@ def rm_dups(): job=NewJob( "rmdups", 0, None, jex ) st.SetMessage( f"Created Job #{job.id} to delete duplicate files") - return render_template("base.html") + return redirect("/jobs") ################################################################################ # /restore_files -> create a job to restore files for the b/e to process @@ -462,7 +474,7 @@ def restore_files(): job=NewJob( "restore_files", 0, None, jex ) st.SetMessage( f"Created Job #{job.id} to restore selected file(s)") - return render_template("base.html") + return redirect("/jobs") ################################################################################ # /delete_files -> create a job to delete files for the b/e to process @@ -476,7 +488,7 @@ def delete_files(): job=NewJob( "delete_files", 0, None, jex ) st.SetMessage( f"Created Job #{job.id} to delete selected file(s)") - return render_template("base.html") + return redirect("/jobs") ################################################################################ # /move_files -> create a job to move files for the b/e to process @@ -490,7 +502,7 @@ def move_files(): jex.append( JobExtra( name=f"{el}", value=request.form[el] ) ) job=NewJob( "move_files", 0, None, jex ) st.SetMessage( f"Created Job #{job.id} to move selected file(s)") - return render_template("base.html") + return redirect("/jobs") ################################################################################ # /viewlist -> get new set of eids and set current to new img to view @@ -533,6 +545,20 @@ def viewlist(): return render_template("viewer.html", current=current, eids=eids, objs=objs, OPT=OPT ) +@login_required +@app.route("/new_view/", methods=["GET"]) +def newview_img(id): + OPT=Options( request ) + objs = {} + lst = OPT.view_eids.split(',') + print( f"lst={lst}" ) + for e in Entry.query.join(File).filter(Entry.id.in_(lst)).all(): + objs[e.id]=e + # put locn data back into array format + for face in e.file_details.faces: + face.locn = json.loads(face.locn) + return render_template("viewer.html", current=int(id), eids=OPT.view_eids, objs=objs, OPT=OPT ) + ################################################################################ # /view/id -> grabs data from DB and views it ################################################################################ @@ -540,7 +566,7 @@ def viewlist(): @login_required def view_img(id): OPT=Options( request ) - eids=request.form['eids'].rstrip(',') + return redirect( "/new_view/" + id ); objs = {} lst = eids.split(',') for e in Entry.query.join(File).filter(Entry.id.in_(lst)).all(): diff --git a/options.py b/options.py index 08974a0..e9ca3b0 100644 --- a/options.py +++ b/options.py @@ -23,9 +23,10 @@ class PA_PREF(db.Model): fullscreen = db.Column(db.Boolean, unique=False, nullable=False ) root = db.Column(db.String, unique=False, nullable=False ) cwd = db.Column(db.String, unique=False, nullable=False ) + view_eids = db.Column(db.String, unique=False, nullable=False ) def __repr__(self): - return f"" + return f"" ################################################################################ @@ -37,8 +38,13 @@ class Options(PA): def __init__(self, request): if 'orig_url' in request.form: url = request.form['orig_url'] + if 'eids' in request.form: + print( "setting view_eids due to form" ) + self.view_eids = request.form['eids'].rstrip(',') else: url = request.path + print( "setting view_eids due to null (for now)" ) + self.view_eids="" self.orig_url=url if 'files_sp' in url: self.path_type = 'Storage' @@ -78,6 +84,7 @@ class Options(PA): if pref: self.folders=pref.folders self.noo=pref.noo + self.view_eids=pref.view_eids else: self.folders=False self.noo="Oldest" @@ -138,7 +145,7 @@ class Options(PA): pref=PA_PREF.query.filter(PA_PREF.pa_user_dn==current_user.dn,PA_PREF.path_type==self.path_type).first() if not pref: pref=PA_PREF( pa_user_dn=current_user.dn, path_type=self.path_type, noo=self.noo, grouping=self.grouping, how_many=self.how_many, - st_offset=self.offset, size=self.size, folders=self.folders, root=self.root, cwd=self.cwd) + st_offset=self.offset, size=self.size, folders=self.folders, root=self.root, cwd=self.cwd, view_eids=self.view_eids) else: pref.noo=self.noo pref.grouping=self.grouping @@ -148,6 +155,7 @@ class Options(PA): pref.folders=self.folders pref.root = self.root pref.cwd = self.cwd + pref.view_eids = self.view_eids db.session.add(pref) db.session.commit() diff --git a/templates/file_list.html b/templates/file_list.html index 344c329..795225e 100644 --- a/templates/file_list.html +++ b/templates/file_list.html @@ -4,8 +4,6 @@
- -
diff --git a/templates/prefs.html b/templates/prefs.html index 1539ab5..fca1ba2 100644 --- a/templates/prefs.html +++ b/templates/prefs.html @@ -5,7 +5,7 @@ - + {% for pref in prefs %} @@ -20,6 +20,7 @@ + {% endfor %}
PathNew or OldestHow ManyFolders?Group byThumb sizeFullscreenDB retrieve offsetRootcwd
PathNew or OldestHow ManyFolders?Group byThumb sizeFullscreenDB retrieve offsetRootcwdView eids
{{pref.st_offset}} {{pref.root}} {{pref.cwd}}{{pref.view_eids}}