Commit 1ee9236b authored by Andreas Valder's avatar Andreas Valder
Browse files

added thumbnails for livestreams, closes #251

parent 621f4936
from server import *
from sorter import schedule_thumbnail
def genlive(streams):
for stream in streams:
stream['visible'] = True
stream['downloadable'] = False
stream['path'] = 'pub/hls/%s.m3u8'%stream['livehandle']
stream['file_size'] = 0
return streams
@sched_func(30)
def livestream_thumbnail():
livestreams = query('''SELECT streams.handle AS livehandle, streams.lecture_id, "formats" AS sep, formats.*
FROM streams
JOIN lectures ON lectures.id = streams.lecture_id
JOIN formats ON formats.keywords = "hls"
WHERE streams.active AND (? OR streams.visible)
''', ismod())
for v in genlive(livestreams):
schedule_thumbnail(v.lecture_id)
......@@ -381,13 +381,7 @@ def courses():
groupedby = 'semester'
return render_template('courses.html', courses=courses, groupedby=groupedby)
def genlive(streams):
for stream in streams:
stream['visible'] = True
stream['downloadable'] = False
stream['path'] = 'pub/hls/%s.m3u8'%stream['livehandle']
stream['file_size'] = 0
return streams
from livestreams import genlive
@app.route('/<handle>')
@app.route('/<int:id>')
......@@ -692,3 +686,4 @@ if 'JOBS_API_KEY' in config:
import timetable
import chapters
import icalexport
import livestreams
......@@ -36,7 +36,6 @@ def insert_video(lectureid,dbfilepath,filepath,fileformatid):
schedule_thumbnail(lectureid)
def schedule_thumbnail(lectureid):
path = query('SELECT path FROM videos WHERE lecture_id')
videos = query('''
SELECT videos.path
FROM videos
......
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