Change archive listing to return JSON
This commit is contained in:
parent
abcb47aa6a
commit
83018a963f
@ -3,7 +3,7 @@
|
||||
import os.path
|
||||
from pathlib import Path
|
||||
|
||||
from flask import Flask, render_template, request, send_from_directory
|
||||
from flask import Flask, render_template, request, send_from_directory, jsonify
|
||||
from flask_cors import CORS
|
||||
from werkzeug.utils import secure_filename
|
||||
|
||||
@ -58,5 +58,8 @@ def uploaded_file(filename):
|
||||
def archive():
|
||||
"""Serve the archive listing."""
|
||||
listing = os.listdir(UPLOAD_DIRECTORY)
|
||||
files = filter(lambda f: f.endswith(".wav"), listing)
|
||||
return render_template("archive.html", files=files)
|
||||
filenames = filter(lambda f: f.endswith(".wav"), listing)
|
||||
return jsonify([
|
||||
"{}{}".format(request.url_root, filename)
|
||||
for filename in filenames
|
||||
])
|
||||
|
Loading…
Reference in New Issue
Block a user