Commit 11ffa116 authored by Julian Rother's avatar Julian Rother
Browse files

Fixed livestream handle names

parent f9fdf6cd
......@@ -9,7 +9,7 @@ def livestream_thumbnail():
livestreams = query('SELECT streams.lecture_id, streams.handle AS livehandle FROM streams WHERE')
lectures = query('SELECT * FROM lectures WHERE stream_job IS NOT NULL')
for v in genlive(livestreams)+genlive_new(lectures):
schedule_job('thumbnail', {'src': v['path'], 'filename': 'l_%i.jpg'%v['lecture_id']})
schedule_job('thumbnail', {'src': v['path'], 'filename': '%i.jpg'%v['lecture_id']})
@app.route('/internal/streaming/legacy_auth', methods=['GET', 'POST'])
@app.route('/internal/streaming/legacy_auth/<server>', methods=['GET', 'POST'])
......@@ -141,8 +141,8 @@ def genlive_new(lectures):
for lecture in lectures:
if not lecture['stream_job']:
res.append({'livehandle': 'l_%i'%lecture['id'], 'visible': True,
'downloadable': False, 'path': 'pub/hls/l_%i.m3u8'%lecture['id'],
res.append({'livehandle': '%i'%lecture['id'], 'visible': True,
'downloadable': False, 'path': 'pub/hls/%i.m3u8'%lecture['id'],
'file_size': 0, 'formats': hls_format, 'lecture_id': lecture['id']})
return res
......@@ -186,7 +186,7 @@ def index():
WHERE lectures.stream_job IS NOT NULL AND (? OR (courses.visible AND courses.listed AND lectures.visible))
''', ismod())
for stream in livestreams_new:
stream['livehandle'] = 'l_%i'%stream['id']
stream['livehandle'] = '%i'%stream['id']
featured = query('SELECT * FROM featured WHERE (? OR visible) ORDER BY `order`', ismod())
featured = list(filter(lambda x: not x['deleted'], featured))
for item in featured:
......@@ -398,7 +398,7 @@ def auth(): # For use with nginx auth_request
if url.endswith('jpg') or ismod():
return "OK", 200
if url.startswith('pub/hls/'):
handle = url[len('pub/hls/'):].rsplit('_')[0].split('.')[0]
handle = url[len('pub/hls/'):].split('_')[0].split('.')[0]
if handle.startswith('l_'):
perms = query('''SELECT AS lecture, perm.*
FROM lectures
Supports Markdown
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