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
Iterations
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
Video AG Infrastruktur
website
Commits
e9b0ccb6
Commit
e9b0ccb6
authored
8 years ago
by
Andreas Valder
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of git.fsmpi.rwth-aachen.de:julianundandyfrickelnkram/videoagwebsite
parents
21499da7
0dc29c2d
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
server.py
+28
-2
28 additions, 2 deletions
server.py
templates/macros.html
+5
-5
5 additions, 5 deletions
templates/macros.html
with
33 additions
and
7 deletions
server.py
+
28
−
2
View file @
e9b0ccb6
...
...
@@ -15,10 +15,12 @@ config['SQLITE_DB'] = 'db.sqlite'
config
[
'
SQLITE_INIT_SCHEMA
'
]
=
True
config
[
'
SQLITE_INIT_DATA
'
]
=
False
config
[
'
DEBUG
'
]
=
False
config
[
'
VIDEOPREFIX
'
]
=
'
https://videoag.fsmpi.rwth-aachen.de
'
if
__name__
==
'
__main__
'
:
config
[
'
SQLITE_INIT_DATA
'
]
=
True
config
[
'
DEBUG
'
]
=
True
config
.
from_pyfile
(
'
config.py
'
,
silent
=
True
)
app
.
jinja_env
.
globals
[
'
videoprefix
'
]
=
config
[
'
VIDEOPREFIX
'
]
if
config
[
'
DB_ENGINE
'
]
==
'
sqlite
'
:
created
=
not
os
.
path
.
exists
(
config
[
'
SQLITE_DB
'
])
...
...
@@ -243,13 +245,37 @@ def edit():
'
comment
'
,
'
internal
'
])
}
query
(
'
BEGIN TRANSACTION
'
)
for
key
,
val
in
request
.
get_json
():
if
request
.
is_json
():
changes
=
request
.
get_json
().
items
()
else
:
changes
=
request
.
args
.
items
()
for
key
,
val
in
changes
:
table
,
id
,
column
=
key
.
split
(
'
.
'
,
2
)
assert
table
in
tabs
assert
column
in
tabs
[
table
][
2
]
query
(
'
UPDATE %s SET %s = ? WHERE %s = ?
'
%
(
tabs
[
table
][
0
],
column
,
tabs
[
table
][
1
]),
val
,
id
)
query
(
'
COMMIT TRANSACTION
'
)
return
"
OK
"
,
200
@app.route
(
'
/auth
'
)
def
auth
():
# For use with nginx auth_request
if
'
X-Original-Uri
'
not
in
request
.
headers
:
return
'
Internal Server Error
'
,
500
url
=
request
.
headers
[
'
X-Original-Uri
'
].
lstrip
(
config
[
'
VIDEOPREFIX
'
])
videos
=
query
(
'''
SELECT videos.path
FROM videos
JOIN lectures ON (videos.lecture_id = lectures.id)
JOIN courses ON (lectures.course_id = courses.id)
WHERE videos.path = ?
AND (? OR (courses.visible AND lectures.visible AND videos.visible))
'''
,
url
,
ismod
())
if
videos
and
url
.
startswith
(
'
pub
'
):
return
"
OK
"
,
200
elif
videos
and
ismod
():
return
"
OK
"
,
200
else
:
return
"
Not allowed
"
,
403
if
__name__
==
'
__main__
'
:
app
.
run
()
app
.
run
(
threaded
=
True
)
This diff is collapsed.
Click to expand it.
templates/macros.html
+
5
−
5
View file @
e9b0ccb6
...
...
@@ -3,7 +3,7 @@
<li
class=
"list-group-item"
>
<a
class=
"hidden-xs"
href=
"/play?lectureid={{ lecture['id'] }}"
title=
"{{ lecture['coursetitle'] }}"
>
<div
class=
"row"
>
<img
class=
"col-xs-4"
src=
"
https://videoag.fsmpi.rwth-aachen.de
/{{ lecture['titlefile'] }}"
alt=
"Vorschaubild"
>
<img
class=
"col-xs-4"
src=
"
{{ videoprefix }}
/{{ lecture['titlefile'] }}"
alt=
"Vorschaubild"
>
<div
class=
"col-xs-4"
>
<span
style=
"color: #000;"
><strong>
{{ lecture['short'] }}
</strong></span><br>
<span
style=
"color: #000;"
>
{{ lecture['time'] }}
</span>
...
...
@@ -19,7 +19,7 @@
</a>
<a
class=
"visible-xs"
href=
"/play?lectureid={{ lecture['id'] }}"
title=
"{{ lecture['coursetitle'] }}"
>
<div
class=
"row"
>
<img
class=
"col-xs-12"
src=
"
https://videoag.fsmpi.rwth-aachen.de
/{{ lecture['titlefile'] }}"
alt=
"Vorschaubild"
>
<img
class=
"col-xs-12"
src=
"
{{ videoprefix }}
/{{ lecture['titlefile'] }}"
alt=
"Vorschaubild"
>
</div>
<div
class=
"row"
>
<div
class=
"col-xs-12"
>
...
...
@@ -54,7 +54,7 @@
<link
rel=
"stylesheet"
href=
"static/mediaelementjs/mediaelementplayer.css"
/>
<video
class=
"mejs-player"
width=
"640"
height=
"360"
style=
"width: 100%; height: 100%;"
>
{% for v in videos %}
<source
type=
"video/mp4"
src=
"
https://videoag.fsmpi.rwth-aachen.de
/{{ v.path }}"
/>
<source
type=
"video/mp4"
src=
"
{{ videoprefix }}
/{{ v.path }}"
/>
{% endfor %}
</video>
<script>
...
...
@@ -94,13 +94,13 @@
<button
class=
"btn btn-primary dropdown-toggle {% if videos|length is equalto 0 %}disabled{% endif %}"
type=
"button"
data-toggle=
"dropdown"
>
Download
<span
class=
"caret"
></span></button>
<ul
class=
"dropdown-menu"
>
{% for v in videos %}
<li><a
href=
"
https://video.fsmpi.rwth-aachen.de
/{{v.path}}"
>
{{v.format_description}} ({{v.file_size|filesizeformat(true)}})
</a></li>
<li><a
href=
"
{{ videoprefix }}
/{{v.path}}"
>
{{v.format_description}} ({{v.file_size|filesizeformat(true)}})
</a></li>
{% endfor %}
</ul>
<noscript>
<ul
class=
"pull-right list-unstyled"
style=
"margin-left:10px;"
>
{% for v in videos %}
<li><a
href=
"
https://video.fsmpi.rwth-aachen.de
/{{v.path}}"
>
{{v.format_description}} ({{v.file_size|filesizeformat(true)}})
</a></li>
<li><a
href=
"
{{ videoprefix }}
/{{v.path}}"
>
{{v.format_description}} ({{v.file_size|filesizeformat(true)}})
</a></li>
{% endfor %}
</ul>
</noscript>
...
...
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