|
|
|
@ -23,10 +23,10 @@ attachment_filenames = {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class DownloadForm(FlaskForm):
|
|
|
|
|
start_time = DateTimeField('Start time',
|
|
|
|
|
start_time = DateTimeField('Startzeit',
|
|
|
|
|
validators=[InputRequired()],
|
|
|
|
|
format='%Y-%m-%d %H:%M')
|
|
|
|
|
length = IntegerField('Length',
|
|
|
|
|
length = IntegerField('Länge',
|
|
|
|
|
validators=[
|
|
|
|
|
InputRequired(),
|
|
|
|
|
NumberRange(min=1, max=app.config['MAX_LENGTH'])])
|
|
|
|
@ -43,12 +43,12 @@ def download():
|
|
|
|
|
try:
|
|
|
|
|
output_filename, attachment_filename = prepare_download(form)
|
|
|
|
|
attachment_filenames[output_filename] = attachment_filename
|
|
|
|
|
flash('The download should start immediately.', 'success')
|
|
|
|
|
flash('Der Download sollte sofort starten.', 'success')
|
|
|
|
|
return render_template('download.html', form=form, filename=output_filename)
|
|
|
|
|
except ValueError as e:
|
|
|
|
|
flash('Error preparing download: {}'.format(e), 'warning')
|
|
|
|
|
flash('Fehler beim Erstellen des Downloads: {}'.format(e), 'warning')
|
|
|
|
|
else:
|
|
|
|
|
flash('Error in form!', 'warning')
|
|
|
|
|
flash('Fehler im Formular!', 'warning')
|
|
|
|
|
return render_template('download.html', form=form)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -96,7 +96,7 @@ def prepare_download(form):
|
|
|
|
|
if source['start_time'] <= form.start_time.data < source['start_time'] + source['length']:
|
|
|
|
|
start_index = i
|
|
|
|
|
if start_index is None:
|
|
|
|
|
raise ValueError('Could not find start file')
|
|
|
|
|
raise ValueError('Konnte Startdatei nicht finden!')
|
|
|
|
|
sources = sources[start_index:]
|
|
|
|
|
|
|
|
|
|
# Super lazy: Limit to 5 source files input
|
|
|
|
|