added admin routes/code to allow a scan now and a forced scan

This commit is contained in:
2021-01-12 18:45:13 +11:00
parent e83a40ee52
commit 684d057e59
3 changed files with 26 additions and 3 deletions

View File

@@ -186,7 +186,29 @@ def file_list():
def files():
return render_template("files.html", page_title='View Files', file_data=filedata, alert=st.GetAlert(), message=st.GetMessage() )
################################################################################
# /files/scannow -> allows us to force a check for new files
################################################################################
@app.route("/files/scannow", methods=["GET"])
def scannow():
filedata.GenerateFileData()
return render_template("base.html", page_title='Forced look for new items', file_data=filedata, alert="success", message="Scanned for new files" )
################################################################################
# /files/forcescan -> deletes old data in DB, and does a brand new scan
################################################################################
@app.route("/files/forcescan", methods=["GET"])
def forcescan():
Files.query.delete()
Settings.query.all()[0].last_import_date=0
db.session.commit()
filedata.GenerateFileData()
return render_template("base.html", page_title='Forced look for new items', file_data=filedata, alert="success", message="Forced remove and recreation of all file data" )
################################################################################
# /static -> returns the contents of any file referenced inside /static.
# we create/use symlinks in static/ to reference the images to show
################################################################################
@app.route("/static/<filename>")
def custom_static(filename):
return send_from_directory("static/", filename)