|
|
@ -29,10 +29,14 @@ def download():
|
|
|
|
form.start_time.data = datetime.now() - timedelta(hours=1)
|
|
|
|
form.start_time.data = datetime.now() - timedelta(hours=1)
|
|
|
|
form.length.data = 60
|
|
|
|
form.length.data = 60
|
|
|
|
elif form.validate_on_submit():
|
|
|
|
elif form.validate_on_submit():
|
|
|
|
|
|
|
|
output_filename = prepare_download(form)
|
|
|
|
|
|
|
|
if output_filename:
|
|
|
|
flash('The download should start immediately.', 'success')
|
|
|
|
flash('The download should start immediately.', 'success')
|
|
|
|
return render_template('download.html', form=form, filename='test.mp3')
|
|
|
|
return render_template('download.html', form=form, filename=output_filename)
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
flash('Error', 'warning')
|
|
|
|
flash('Error preparing download!', 'warning')
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
flash('Error in form!', 'warning')
|
|
|
|
return render_template('download.html', form=form)
|
|
|
|
return render_template('download.html', form=form)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -42,5 +46,9 @@ def download_file(filename):
|
|
|
|
as_attachment=True)
|
|
|
|
as_attachment=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def prepare_download(form):
|
|
|
|
|
|
|
|
return 'test.mp3'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
if __name__ == '__main__':
|
|
|
|
app.run(debug=True)
|
|
|
|
app.run(debug=True)
|
|
|
|