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