diff --git a/TODO b/TODO index c349f57..21aa9c6 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,4 @@ -### DB +## DB NEW_FILE -> add, has_unidentified_face ?has_face?, @@ -28,7 +28,6 @@ all images with faces, or if we 'reset face_flag' rescan all images ### UI - * get basic search to work ### AI * store reference images (UI allows this now) diff --git a/files.py b/files.py index 2974458..8b57d8b 100644 --- a/files.py +++ b/files.py @@ -21,7 +21,7 @@ import time ################################################################################ from settings import Settings from job import Job, Joblog, NewJob -from person import Person +from person import Person, File_Person_Link ################################################################################ # Class describing File in the database, and via sqlalchemy, connected to the DB as well @@ -90,6 +90,18 @@ def file_list(): def files(): return render_template("files.html", page_title='View Files', entry_data=Entry.query.all()) +################################################################################ +# /search -> show thumbnail view of files from import_path(s) +################################################################################ +@app.route("/search", methods=["GET","POST"]) +def search(): + + file_data=Entry.query.filter(Entry.name.ilike(f"%{request.form['term']}%")).all() + ai_data=Entry.query.join(File).join(File_Person_Link).filter(File_Person_Link.file_id==File.eid).join(Person).filter(Person.tag.ilike(f"%{request.form['term']}%")).all() + + all_entries = file_data + ai_data + return render_template("files.html", page_title='View Files', entry_data=all_entries) + ################################################################################ # /files/scannow -> allows us to force a check for new files ################################################################################