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
Roman Karwacik
website
Commits
b4c40af6
Commit
b4c40af6
authored
7 years ago
by
Andreas Valder
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of git.fsmpi.rwth-aachen.de:videoagwebsite/videoagwebsite
parents
f6616863
56861916
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
+34
-0
34 additions, 0 deletions
livestreams.py
server.py
+2
-2
2 additions, 2 deletions
server.py
templates/macros.html
+2
-2
2 additions, 2 deletions
templates/macros.html
with
38 additions
and
4 deletions
livestreams.py
+
34
−
0
View file @
b4c40af6
...
...
@@ -7,3 +7,37 @@ def livestream_thumbnail():
for
v
in
genlive
(
livestreams
):
sorter
.
schedule_thumbnail
(
v
[
'
lecture_id
'
],
v
[
'
path
'
])
@app.route
(
'
/internal/streaming/legacy_auth
'
,
methods
=
[
'
GET
'
,
'
POST
'
])
def
streamauth
():
internal
=
False
for
net
in
config
.
get
(
'
FSMPI_IP_RANGES
'
,
[]):
if
ip_address
(
request
.
headers
[
'
X-Real-IP
'
])
in
ip_network
(
net
):
internal
=
True
if
request
.
values
[
'
app
'
]
!=
'
live
'
:
return
'
Bad request
'
,
400
if
not
internal
:
return
'
Forbidden
'
,
403
if
request
.
values
[
'
pass
'
]
!=
'
caisoh8aht0wuSu
'
:
return
'
Forbidden
'
,
403
if
request
.
values
[
'
call
'
]
==
'
publish
'
:
matches
=
query
(
"
SELECT lectures.* FROM lectures JOIN courses ON lectures.course_id = courses.id WHERE courses.handle = ? ORDER BY lectures.time DESC
"
,
request
.
values
[
'
name
'
])
now
=
datetime
.
now
()
match
=
{
'
id
'
:
-
1
}
for
lecture
in
matches
:
if
lecture
[
'
time
'
]
-
timedelta
(
minutes
=
30
)
<=
now
and
\
now
<=
lecture
[
'
time
'
]
+
timedelta
(
minutes
=
lecture
[
'
duration
'
]):
match
=
lecture
break
if
'
lecture
'
in
request
.
values
:
match
=
{
'
id
'
:
request
.
values
[
'
lecture
'
]}
try
:
modify
(
"
INSERT INTO streams (handle, active, visible, lecture_id, description, poster) VALUES (?, 0, 1, -1,
""
,
""
)
"
,
request
.
values
[
'
name
'
])
except
:
pass
modify
(
"
UPDATE streams SET active = 1, lecture_id = ? WHERE handle = ?
"
,
match
[
'
id
'
],
request
.
values
[
'
name
'
])
elif
request
.
values
[
'
call
'
]
==
'
publish_done
'
:
modify
(
"
UPDATE streams SET active = 0 WHERE handle = ?
"
,
request
.
values
[
'
name
'
])
else
:
return
'
Bad request
'
,
400
return
'
OK
'
,
200
This diff is collapsed.
Click to expand it.
server.py
+
2
−
2
View file @
b4c40af6
...
...
@@ -379,7 +379,7 @@ def index():
item
[
'
courses
'
]
=
query
(
'
SELECT * FROM courses WHERE (visible AND listed) AND `%s` = ? ORDER BY `%s`
'
%
(
item
[
'
param
'
],
item
[
'
param
'
]),
item
[
'
param2
'
])
elif
item
[
'
type
'
]
==
'
video
'
:
item
[
'
lecture
'
]
=
{
'
id
'
:
item
[
'
param
'
]}
live
streams
=
query
(
'''
SELECT streams.handle AS livehandle, streams.lecture_id,
"
formats
"
AS sep, formats.*
streams
=
query
(
'''
SELECT streams.handle AS livehandle, streams.lecture_id,
"
formats
"
AS sep, formats.*
FROM streams
JOIN lectures ON lectures.id = streams.lecture_id
JOIN formats ON formats.keywords =
"
hls
"
...
...
@@ -391,7 +391,7 @@ def index():
JOIN formats ON (videos.video_format = formats.id)
WHERE videos.lecture_id = ? AND videos.visible
ORDER BY formats.prio DESC
'''
,
item
[
'
param
'
])
+
genlive
(
live
streams
)
'''
,
item
[
'
param
'
])
+
genlive
(
streams
)
return
render_template
(
'
index.html
'
,
latestvideos
=
livestreams
+
latestvideos
,
upcomming
=
upcomming
,
featured
=
featured
)
@app.route
(
'
/courses
'
)
...
...
This diff is collapsed.
Click to expand it.
templates/macros.html
+
2
−
2
View file @
b4c40af6
...
...
@@ -404,7 +404,7 @@ $('#embedcodebtn').popover(
{% endfor %}
</ul>
</div></li>
<li>
{{ moderator_editor(('featured',item.id,'param2'), item.param2) }}
</li>
<li>
{{ moderator_editor(('featured',item.id,'param2'), item.param2
, reload=True
) }}
</li>
</ul>
{% endif %}
Die vollständige Liste findest du
<a
href=
"{{ url_for('courses') }}"
>
hier
</a>
.
...
...
@@ -416,7 +416,7 @@ $('#embedcodebtn').popover(
{{ player(item.lecture, item.videos, autoplay=False)}}
{% endif %}
{% if ismod() %}
<div>
ID des Videos: {{ moderator_editor(('featured',item.id,'param'), item.param) }}
</div>
<div>
ID des Videos: {{ moderator_editor(('featured',item.id,'param'), item.param
, reload=True
) }}
</div>
{% endif %}
<div>
{{ moderator_editor(('featured',item.id,'param2'), item.param2) }}
</div>
</div>
...
...
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