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 * ...@@ -2,12 +2,12 @@ from server import *
@sched_func(30) @sched_func(30)
def livestream_thumbnail(): 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 FROM streams
JOIN lectures ON lectures.id = streams.lecture_id JOIN lectures ON lectures.id = streams.lecture_id
JOIN formats ON formats.keywords = "hls" WHERE streams.active)
WHERE streams.active AND (? OR streams.visible) ''')
''', ismod())
for v in genlive(livestreams): 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): ...@@ -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()) query('INSERT INTO sortlog (lecture_id,video_id,path,`when`) VALUES (?,?,?,?)', lectureid, video_id, dbfilepath, datetime.now())
schedule_thumbnail(lectureid) schedule_thumbnail(lectureid)
def schedule_thumbnail(lectureid): def schedule_thumbnail(lectureid, filePath=None):
videos = query(''' videos = query('''
SELECT videos.path SELECT videos.path
FROM videos FROM videos
...@@ -44,6 +44,8 @@ def schedule_thumbnail(lectureid): ...@@ -44,6 +44,8 @@ def schedule_thumbnail(lectureid):
ORDER BY formats.prio DESC''', lectureid ) ORDER BY formats.prio DESC''', lectureid )
if videos: if videos:
path = videos[0]['path'] path = videos[0]['path']
elif filePath:
path = filePath
else: else:
return return
data = '{"lectureid": "'+str(lectureid)+'", "path": "'+path+'"}' 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