show the path

main
vitrinekast 2 months ago
parent 6332dd11c1
commit 264d571c3e

@ -22,7 +22,7 @@ def index():
@app.route("/submitted") @app.route("/submitted")
def submitted(): def submitted():
print("doingsubmit") print("doingsubmit")
return render_template('index.html', error=request.args.get('error'), submitted=True) return render_template('index.html', error=request.args.get('error'), submitted=True, saved_path=request.args.get('path'))
def get_random_subfolder(): def get_random_subfolder():
# folder = os.listdir(app.config['UPLOAD_FOLDER']) # folder = os.listdir(app.config['UPLOAD_FOLDER'])
@ -63,7 +63,7 @@ def upload_file():
img.thumbnail((100, 100), Image.LANCZOS) img.thumbnail((100, 100), Image.LANCZOS)
img.save(os.path.join(sub_folder, filename)) img.save(os.path.join(sub_folder, filename))
return redirect(url_for('submitted')) return redirect(url_for('submitted', path=os.path.join(sub_folder, filename)))
elif ext in ['mp4', 'avi', 'mov', 'flv']: elif ext in ['mp4', 'avi', 'mov', 'flv']:
file.save(temp_path) file.save(temp_path)
@ -81,7 +81,7 @@ def upload_file():
ffmpeg.execute() ffmpeg.execute()
os.remove(temp_path) os.remove(temp_path)
return redirect(url_for('submitted')) return redirect(url_for('submitted', path=out_path))
elif ext in ['mp3', 'wav', 'flac']: elif ext in ['mp3', 'wav', 'flac']:
out_path = os.path.join(sub_folder, filename.rsplit('.', 1)[0].lower() + '.mp3') out_path = os.path.join(sub_folder, filename.rsplit('.', 1)[0].lower() + '.mp3')
file.save(temp_path) file.save(temp_path)
@ -98,7 +98,8 @@ def upload_file():
ffmpeg.execute() ffmpeg.execute()
os.remove(temp_path) os.remove(temp_path)
return redirect(url_for('submitted')) return redirect(url_for('submitted', path=out_path))
else: else:
print("not an image!") print("not an image!")
return redirect(url_for('submitted', Error="The file you are trying to upload is not supported by our infra-ordinary")) return redirect(url_for('submitted', Error="The file you are trying to upload is not supported by our infra-ordinary"))

@ -9,7 +9,7 @@
<style> <style>
@font-face { @font-face {
font-family: Montserrat; font-family: Montserrat;
src: url(Montserrat-VariableFont_wght.ttf); src: url(templates/Montserrat-VariableFont_wght.ttf);
} }
html, html,
body { body {
@ -200,7 +200,7 @@
</div> </div>
<h2>Upload your Infraordinary Observations:</h2> <h2>Upload your Infraordinary Observations:</h2>
<p>Inform our mapping by sharing your experiences with the infraordinary. It can be an image, video or audio file, upload your media here!</p> <p>Inform our mapping by sharing your experiences with the infraordinary. It can be an image, video or audio file, upload your media here!</p>
<p>{{saved_path}}</p>
{% if error %} {% if error %}
<h1 class="error">Oops.. Something went wrong: {{ error }}!</h1> <h1 class="error">Oops.. Something went wrong: {{ error }}!</h1>
{% endif %} {% endif %}

Loading…
Cancel
Save