From fe576c2c6600d6e1e279bc92989772b740049df1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Olivier=20T=C3=A9tard?= Date: Sat, 14 Nov 2015 11:12:59 +0100 Subject: [PATCH] =?utf8?q?Affichage=20du=20json=20associ=C3=A9=20au=20Ogg?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- femtoblackweb.py | 8 ++++++-- templates/analyze_file.html | 7 +++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/femtoblackweb.py b/femtoblackweb.py index aab1433..8a52864 100644 --- a/femtoblackweb.py +++ b/femtoblackweb.py @@ -12,6 +12,7 @@ from flask.ext.socketio import SocketIO, emit, join_room, leave_room, close_room from flask_bootstrap import Bootstrap +import json # configuration @@ -100,9 +101,12 @@ def download(filename): @app.route('/analyze/') def analyze_file(filename): f = os.path.join(app.config['UPLOAD_FOLDER'], filename) + json_file = os.path.join(app.config['UPLOAD_FOLDER'], "{}.json".format(filename)) - if os.path.exists(f): - return render_template('analyze_file.html', filename=filename) + if os.path.exists(f) and os.path.isfile(json_file): + with open(json_file) as json_f: + json_content = json.load(json_f) + return render_template('analyze_file.html', filename=filename, json=json_content) else: abort(404) diff --git a/templates/analyze_file.html b/templates/analyze_file.html index 3be3538..d28ac7b 100644 --- a/templates/analyze_file.html +++ b/templates/analyze_file.html @@ -10,7 +10,7 @@ - +
- + +
+    {{ json }}
+  
{% endblock %} {% block scripts %} -- 2.30.2