Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
Video AG Infrastruktur
website
Commits
a357d26c
Commit
a357d26c
authored
Jul 23, 2018
by
Julian Rother
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added live_source thumbnails and changed thumbnail job parameters
parent
92732788
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
3 deletions
+10
-3
livestreams.py
livestreams.py
+8
-1
sorter.py
sorter.py
+1
-1
templates/streaming.html
templates/streaming.html
+1
-1
No files found.
livestreams.py
View file @
a357d26c
...
...
@@ -8,7 +8,7 @@ import string
def
livestream_thumbnail
():
livestreams
=
query
(
'SELECT streams.lecture_id, streams.handle AS livehandle FROM streams WHERE streams.active'
)
for
v
in
genlive
(
livestreams
):
schedule_job
(
'thumbnail'
,
{
'
lectureid'
:
str
(
v
[
'lecture_id
'
]
)
,
'
path'
:
v
[
'path
'
]})
schedule_job
(
'thumbnail'
,
{
'
src'
:
v
[
'path
'
],
'
filename'
:
'l_%i.jpg'
%
lecture
[
'id
'
]})
@
app
.
route
(
'/internal/streaming/legacy_auth'
,
methods
=
[
'GET'
,
'POST'
])
@
app
.
route
(
'/internal/streaming/legacy_auth/<server>'
,
methods
=
[
'GET'
,
'POST'
])
...
...
@@ -113,6 +113,12 @@ def streamdrop(id):
return
redirect
(
request
.
values
[
'ref'
])
return
'Ok'
,
200
@
sched_func
(
120
)
def
live_source_thumbnail
():
sources
=
query
(
'SELECT * FROM live_sources WHERE clientid IS NOT NULL'
)
for
source
in
sources
:
schedule_job
(
'thumbnail'
,
{
'src'
:
'rtmp://%s/src/%i'
%
(
source
[
'server'
],
source
[
'id'
]),
'filename'
:
's_%i.jpg'
%
source
[
'id'
]})
@
app
.
route
(
'/internal/streaming/auth/<server>'
,
methods
=
[
'GET'
,
'POST'
])
def
streamauth
(
server
):
internal
=
False
...
...
@@ -126,6 +132,7 @@ def streamauth(server):
if
not
sources
:
return
'Not found'
,
404
modify
(
'UPDATE live_sources SET server = ?, server_public = ?, clientid = ?, last_active = ?, preview_key = ? WHERE id = ?'
,
server
,
request
.
args
.
get
(
'public_ip'
,
server
),
request
.
values
[
'clientid'
],
datetime
.
now
(),
gentoken
(),
sources
[
0
][
'id'
])
live_source_thumbnail
()
ret
=
Response
(
'Redirect'
,
301
,
{
'Location'
:
'%i'
%
sources
[
0
][
'id'
]})
ret
.
autocorrect_location_header
=
False
return
ret
...
...
sorter.py
View file @
a357d26c
...
...
@@ -44,7 +44,7 @@ def schedule_thumbnail(lectureid):
JOIN formats ON (videos.video_format = formats.id)
WHERE videos.lecture_id = ?
ORDER BY formats.prio DESC'''
,
lectureid
)
return
schedule_job
(
'thumbnail'
,
{
'
lectureid'
:
str
(
lectureid
),
'path'
:
videos
[
0
][
'path'
]
})
return
schedule_job
(
'thumbnail'
,
{
'
src'
:
videos
[
0
][
'path'
],
'filename'
:
'l_%i.jpg'
%
lectureid
})
@
app
.
route
(
'/internal/jobs/add/thumbnail'
,
methods
=
[
'GET'
,
'POST'
])
@
mod_required
...
...
templates/streaming.html
View file @
a357d26c
...
...
@@ -19,7 +19,7 @@
{% for source in sources %}
<li
class=
"list-group-item{% if source.clientid %} list-group-item-danger{% endif %}"
>
<div
class=
"row"
>
<div
style=
"background-image: url('{{ config.VIDEOPREFIX }}/
hls/preview/
{{ source.id }}.jpg')"
class=
"col-sm-2 col-xs-12 thumbnailimg"
>
<div
style=
"background-image: url('{{ config.VIDEOPREFIX }}/
thumbnail/s_
{{ source.id }}.jpg')"
class=
"col-sm-2 col-xs-12 thumbnailimg"
>
{% if source.clientid %}
<a
href=
"#"
data-toggle=
"modal"
data-target=
"#preview-player"
data-srcname=
"{{ source.name }}"
data-srcid=
"{{ source.id }}"
>
<span
class=
"glyphicon glyphicon-play-circle playpreviewbtn"
></span>
...
...
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