Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Roman Karwacik
website
Commits
7b68cf9f
Commit
7b68cf9f
authored
Jul 26, 2017
by
Andreas Valder
Browse files
another try
parent
d5c2ce55
Changes
2
Hide whitespace changes
Inline
Side-by-side
livestreams.py
View file @
7b68cf9f
...
...
@@ -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'
]
)
sorter.py
View file @
7b68cf9f
...
...
@@ -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
+
'"}'
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment