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
11ffa116
Commit
11ffa116
authored
Jul 28, 2018
by
Julian Rother
Browse files
Fixed livestream handle names
parent
f9fdf6cd
Changes
2
Hide whitespace changes
Inline
Side-by-side
livestreams.py
View file @
11ffa116
...
...
@@ -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'
])
...
...
server.py
View file @
11ffa116
...
...
@@ -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/'
):].
r
split
(
'_'
)[
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
...
...
Write
Preview
Markdown
is supported
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