Skip to content
Snippets Groups Projects
Commit d0c6f1a5 authored by Julian Rother's avatar Julian Rother
Browse files

Parametrized play page

parent cecc586f
No related branches found
No related tags found
No related merge requests found
#!/bin/python #!/bin/python
from flask import Flask, render_template, g from flask import Flask, render_template, g, request, url_for, redirect
import mysql.connector import mysql.connector
import sqlite3 import sqlite3
import os import os
...@@ -77,7 +77,13 @@ def faq(): ...@@ -77,7 +77,13 @@ def faq():
@app.route('/play') @app.route('/play')
def play(): def play():
return render_template('play.html', active_page='play') if 'lectureid' in request.args:
id = request.args['lectureid']
return render_template('play.html',
lecture=query('SELECT * FROM lectures WHERE id = ?', id)[0],
videos=query('SELECT * FROM videos WHERE lecture_id = ?', id))
else:
return redirect(url_for(index))
if __name__ == '__main__': if __name__ == '__main__':
app.run() app.run()
...@@ -21,10 +21,10 @@ ...@@ -21,10 +21,10 @@
{% endmacro %} {% endmacro %}
{% macro player() %} {% macro player(lecture, videos) %}
<script src="static/mediaelementjs/mediaelement-and-player.min.js"></script> <script src="static/mediaelementjs/mediaelement-and-player.min.js"></script>
<link rel="stylesheet" href="static/mediaelementjs/mediaelementplayer.css" /> <link rel="stylesheet" href="static/mediaelementjs/mediaelementplayer.css" />
<video class="mejs-player" width="640" height="360" style="width: 100%; height: 80%;"> <video class="mejs-player" width="640" height="360" style="width: 100%; height: 80%;">
<source type="video/mp4" src="https://videoag.fsmpi.rwth-aachen.de/pub/16ss-dsal/16ss-dsal-160715-720p_1.mp4" /> <source type="video/mp4" src="https://videoag.fsmpi.rwth-aachen.de/{{ videos[0]['path'] }}" />
</video> </video>
{% endmacro %} {% endmacro %}
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block content %} {% block content %}
<div> <div>
{{ player() }} {{ player(lecture, videos) }}
</div> </div>
{% endblock %} {% endblock %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment