Skip to content
Snippets Groups Projects
Commit 7b68cf9f authored by Andreas Valder's avatar Andreas Valder
Browse files

another try

parent d5c2ce55
No related branches found
No related tags found
No related merge requests found
......@@ -2,12 +2,12 @@ from server import *
@sched_func(30)
def livestream_thumbnail():
livestreams = query('''SELECT streams.handle AS livehandle, streams.lecture_id, "formats" AS sep, formats.*
livestreams = query('''SELECT streams.lecture_id
FROM streams
JOIN lectures ON lectures.id = streams.lecture_id
JOIN formats ON formats.keywords = "hls"
WHERE streams.active AND (? OR streams.visible)
''', ismod())
WHERE streams.active)
''')
for v in genlive(livestreams):
sorter.schedule_thumbnail(v['lecture_id'])
sorter.schedule_thumbnail(v['lecture_id'], v['path'])
......@@ -35,7 +35,7 @@ def insert_video(lectureid,dbfilepath,filepath,fileformatid):
query('INSERT INTO sortlog (lecture_id,video_id,path,`when`) VALUES (?,?,?,?)', lectureid, video_id, dbfilepath, datetime.now())
schedule_thumbnail(lectureid)
def schedule_thumbnail(lectureid):
def schedule_thumbnail(lectureid, filePath=None):
videos = query('''
SELECT videos.path
FROM videos
......@@ -44,6 +44,8 @@ def schedule_thumbnail(lectureid):
ORDER BY formats.prio DESC''', lectureid )
if videos:
path = videos[0]['path']
elif filePath:
path = filePath
else:
return
data = '{"lectureid": "'+str(lectureid)+'", "path": "'+path+'"}'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment