diff --git a/livestreams.py b/livestreams.py index 063c7fa139e4018ec1e104a90bcde3e4cb49309a..0615afd32a2e2300eda6f0e8db920aa3dadf0946 100644 --- a/livestreams.py +++ b/livestreams.py @@ -9,7 +9,7 @@ def livestream_thumbnail(): 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') 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']) diff --git a/server.py b/server.py index 3a9a7b06e96630503d9178476c183fa5fa488d57..4f6b2f6c2e04caeb8cb1e8d1ef0b3ae518046ee1 100644 --- a/server.py +++ b/server.py @@ -141,8 +141,8 @@ def genlive_new(lectures): for lecture in lectures: if not lecture['stream_job']: continue - 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 lectures.id AS lecture, perm.* FROM lectures