Commit efdac5b6 authored by Andreas Valder's avatar Andreas Valder

fix some linter errors

parent eac90506
......@@ -7,7 +7,7 @@ linter:
- python3 -V
- uname -a
- apt install -y sqlite3 locales-all git python3-flask python3-ldap3 python3-requests python3-lxml python3-icalendar python3-mysql.connector python3-requests python3-coverage pylint3
- pylint3 --indent-string='\t' --indent-after-paren=1 --max-line-length=140 --output-format=text *.py | tee pylint.txt
- pylint3 --indent-string='\t' --indent-after-paren=1 --max-line-length=160 --output-format=text *.py | tee pylint.txt
artifacts:
paths:
- pylint.txt
......
......@@ -15,17 +15,17 @@ def import_xmp_chapters(jobid, jobtype, data, state, status):
if int(chapter['time']) in times:
continue
modify('INSERT INTO chapters (lecture_id, time, text, visible, time_created, time_updated) VALUES (?, ?, ?, 0, ?, ?)',
data['lecture_id'], int(chapter['time']), chapter['text'],
datetime.now(), datetime.now())
data['lecture_id'], int(chapter['time']), chapter['text'],
datetime.now(), datetime.now())
@app.route('/internal/newchapter/<int:lectureid>', methods=['POST', 'GET'])
def suggest_chapter(lectureid):
time = request.values['time']
text = request.values['text']
assert(time and text)
assert time and text
try:
x = datetime.strptime(time,'%H:%M:%S')
time= timedelta(hours=x.hour,minutes=x.minute,seconds=x.second).total_seconds()
x = datetime.strptime(time, '%H:%M:%S')
time = timedelta(hours=x.hour, minutes=x.minute, seconds=x.second).total_seconds()
time = int(time)
except ValueError:
if 'ref' in request.values:
......@@ -58,4 +58,4 @@ def chapters(lectureid):
last = c
if 'json' in request.values:
return Response(json.dumps([{'time': c['time'], 'text': c['text']} for c in chapters]), mimetype='application/json')
return Response(render_template('chapters.srt',chapters=chapters), 200, {'Content-Type':'text/vtt'})
return Response(render_template('chapters.srt', chapters=chapters), 200, {'Content-Type':'text/vtt'})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment