|
|
@ -6,12 +6,14 @@ from datetime import datetime, timedelta
|
|
|
|
@app.route('/', methods=['GET', 'POST'])
|
|
|
|
@app.route('/', methods=['GET', 'POST'])
|
|
|
|
def download():
|
|
|
|
def download():
|
|
|
|
form = DownloadForm()
|
|
|
|
form = DownloadForm()
|
|
|
|
if form.validate_on_submit():
|
|
|
|
if request.method == 'GET':
|
|
|
|
flash('The download should start immediately.')
|
|
|
|
|
|
|
|
return render_template('download.html', form=form, filename='test.mp3')
|
|
|
|
|
|
|
|
elif request.method == 'GET':
|
|
|
|
|
|
|
|
form.date.data = datetime.now() - timedelta(hours = 1)
|
|
|
|
form.date.data = datetime.now() - timedelta(hours = 1)
|
|
|
|
form.length.data = 60
|
|
|
|
form.length.data = 60
|
|
|
|
|
|
|
|
elif form.validate_on_submit():
|
|
|
|
|
|
|
|
flash('The download should start immediately.')
|
|
|
|
|
|
|
|
return render_template('download.html', form=form, filename='test.mp3')
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
flash('Error')
|
|
|
|
return render_template('download.html', form=form)
|
|
|
|
return render_template('download.html', form=form)
|
|
|
|
|
|
|
|
|
|
|
|
@app.route('/download_file/<path:filename>')
|
|
|
|
@app.route('/download_file/<path:filename>')
|
|
|
|