Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
website
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Vincent Wehrwein
website
Commits
a357d26c
Commit
a357d26c
authored
6 years ago
by
Julian Rother
Browse files
Options
Downloads
Patches
Plain Diff
Added live_source thumbnails and changed thumbnail job parameters
parent
92732788
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
livestreams.py
+8
-1
8 additions, 1 deletion
livestreams.py
sorter.py
+1
-1
1 addition, 1 deletion
sorter.py
templates/streaming.html
+1
-1
1 addition, 1 deletion
templates/streaming.html
with
10 additions
and
3 deletions
livestreams.py
+
8
−
1
View file @
a357d26c
...
@@ -8,7 +8,7 @@ import string
...
@@ -8,7 +8,7 @@ import string
def
livestream_thumbnail
():
def
livestream_thumbnail
():
livestreams
=
query
(
'
SELECT streams.lecture_id, streams.handle AS livehandle FROM streams WHERE streams.active
'
)
livestreams
=
query
(
'
SELECT streams.lecture_id, streams.handle AS livehandle FROM streams WHERE streams.active
'
)
for
v
in
genlive
(
livestreams
):
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
'
,
methods
=
[
'
GET
'
,
'
POST
'
])
@app.route
(
'
/internal/streaming/legacy_auth/<server>
'
,
methods
=
[
'
GET
'
,
'
POST
'
])
@app.route
(
'
/internal/streaming/legacy_auth/<server>
'
,
methods
=
[
'
GET
'
,
'
POST
'
])
...
@@ -113,6 +113,12 @@ def streamdrop(id):
...
@@ -113,6 +113,12 @@ def streamdrop(id):
return
redirect
(
request
.
values
[
'
ref
'
])
return
redirect
(
request
.
values
[
'
ref
'
])
return
'
Ok
'
,
200
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
'
])
@app.route
(
'
/internal/streaming/auth/<server>
'
,
methods
=
[
'
GET
'
,
'
POST
'
])
def
streamauth
(
server
):
def
streamauth
(
server
):
internal
=
False
internal
=
False
...
@@ -126,6 +132,7 @@ def streamauth(server):
...
@@ -126,6 +132,7 @@ def streamauth(server):
if
not
sources
:
if
not
sources
:
return
'
Not found
'
,
404
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
'
])
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
=
Response
(
'
Redirect
'
,
301
,
{
'
Location
'
:
'
%i
'
%
sources
[
0
][
'
id
'
]})
ret
.
autocorrect_location_header
=
False
ret
.
autocorrect_location_header
=
False
return
ret
return
ret
...
...
This diff is collapsed.
Click to expand it.
sorter.py
+
1
−
1
View file @
a357d26c
...
@@ -44,7 +44,7 @@ def schedule_thumbnail(lectureid):
...
@@ -44,7 +44,7 @@ def schedule_thumbnail(lectureid):
JOIN formats ON (videos.video_format = formats.id)
JOIN formats ON (videos.video_format = formats.id)
WHERE videos.lecture_id = ?
WHERE videos.lecture_id = ?
ORDER BY formats.prio DESC
'''
,
lectureid
)
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
'
])
@app.route
(
'
/internal/jobs/add/thumbnail
'
,
methods
=
[
'
GET
'
,
'
POST
'
])
@mod_required
@mod_required
...
...
This diff is collapsed.
Click to expand it.
templates/streaming.html
+
1
−
1
View file @
a357d26c
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
{% for source in sources %}
{% for source in sources %}
<li
class=
"list-group-item{% if source.clientid %} list-group-item-danger{% endif %}"
>
<li
class=
"list-group-item{% if source.clientid %} list-group-item-danger{% endif %}"
>
<div
class=
"row"
>
<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 %}
{% if source.clientid %}
<a
href=
"#"
data-toggle=
"modal"
data-target=
"#preview-player"
data-srcname=
"{{ source.name }}"
data-srcid=
"{{ source.id }}"
>
<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>
<span
class=
"glyphicon glyphicon-play-circle playpreviewbtn"
></span>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment