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