all teh german

stable
neingeist 6 years ago
parent 965f0da2bb
commit e1ebe66806

@ -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

@ -11,7 +11,7 @@
{% endblock %} {% endblock %}
{% block page_header %} {% block page_header %}
<h1>Download</h1> <h1>Sendungsmitschnitt herunterladen</h1>
{% endblock %} {% endblock %}
{% block app_content %} {% block app_content %}
@ -25,13 +25,14 @@
{% block scripts %} {% block scripts %}
{{ super() }} {{ super() }}
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script> <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment-with-locales.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.47/js/bootstrap-datetimepicker.min.js"></script> <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.47/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() { $(document).ready(function() {
$('#start_time').datetimepicker({ $('#start_time').datetimepicker({
format:'YYYY-MM-DD HH:mm', locale: 'de',
format: 'YYYY-MM-DD HH:mm',
sideBySide: true sideBySide: true
}); });
$(".alert-success").delay(4000).fadeOut(500, function() { $(".alert-success").delay(4000).fadeOut(500, function() {

Loading…
Cancel
Save