Skip to content
Snippets Groups Projects
Commit 11ffa116 authored by Julian Rother's avatar Julian Rother
Browse files

Fixed livestream handle names

parent f9fdf6cd
No related branches found
No related tags found
No related merge requests found
...@@ -9,7 +9,7 @@ def livestream_thumbnail(): ...@@ -9,7 +9,7 @@ def livestream_thumbnail():
livestreams = query('SELECT streams.lecture_id, streams.handle AS livehandle FROM streams WHERE streams.active') livestreams = query('SELECT streams.lecture_id, streams.handle AS livehandle FROM streams WHERE streams.active')
lectures = query('SELECT * FROM lectures WHERE stream_job IS NOT NULL') lectures = query('SELECT * FROM lectures WHERE stream_job IS NOT NULL')
for v in genlive(livestreams)+genlive_new(lectures): 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', methods=['GET', 'POST'])
@app.route('/internal/streaming/legacy_auth/<server>', methods=['GET', 'POST']) @app.route('/internal/streaming/legacy_auth/<server>', methods=['GET', 'POST'])
......
...@@ -141,8 +141,8 @@ def genlive_new(lectures): ...@@ -141,8 +141,8 @@ def genlive_new(lectures):
for lecture in lectures: for lecture in lectures:
if not lecture['stream_job']: if not lecture['stream_job']:
continue continue
res.append({'livehandle': 'l_%i'%lecture['id'], 'visible': True, res.append({'livehandle': '%i'%lecture['id'], 'visible': True,
'downloadable': False, 'path': 'pub/hls/l_%i.m3u8'%lecture['id'], 'downloadable': False, 'path': 'pub/hls/%i.m3u8'%lecture['id'],
'file_size': 0, 'formats': hls_format, 'lecture_id': lecture['id']}) 'file_size': 0, 'formats': hls_format, 'lecture_id': lecture['id']})
return res return res
...@@ -186,7 +186,7 @@ def index(): ...@@ -186,7 +186,7 @@ def index():
WHERE lectures.stream_job IS NOT NULL AND (? OR (courses.visible AND courses.listed AND lectures.visible)) WHERE lectures.stream_job IS NOT NULL AND (? OR (courses.visible AND courses.listed AND lectures.visible))
''', ismod()) ''', ismod())
for stream in livestreams_new: 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 = query('SELECT * FROM featured WHERE (? OR visible) ORDER BY `order`', ismod())
featured = list(filter(lambda x: not x['deleted'], featured)) featured = list(filter(lambda x: not x['deleted'], featured))
for item in featured: for item in featured:
...@@ -398,7 +398,7 @@ def auth(): # For use with nginx auth_request ...@@ -398,7 +398,7 @@ def auth(): # For use with nginx auth_request
if url.endswith('jpg') or ismod(): if url.endswith('jpg') or ismod():
return "OK", 200 return "OK", 200
if url.startswith('pub/hls/'): 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_'): if handle.startswith('l_'):
perms = query('''SELECT lectures.id AS lecture, perm.* perms = query('''SELECT lectures.id AS lecture, perm.*
FROM lectures FROM lectures
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment