diff --git a/server.py b/server.py index 09d51cb769ae1ab832475bc0a8480ff151964857..1d4e93ee71c187e31dca36f39191d74774345072 100755 --- a/server.py +++ b/server.py @@ -1,5 +1,5 @@ #!/bin/python -from flask import Flask, render_template, g +from flask import Flask, render_template, g, request, url_for, redirect import mysql.connector import sqlite3 import os @@ -77,7 +77,13 @@ def faq(): @app.route('/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__': app.run() diff --git a/templates/macros.html b/templates/macros.html index b6852f81f84760e399817ba421f3b26ace762f26..2b4cc2a08dd5aadcb2d39a63b576f789e2824356 100644 --- a/templates/macros.html +++ b/templates/macros.html @@ -21,10 +21,10 @@ {% endmacro %} -{% macro player() %} +{% macro player(lecture, videos) %} <script src="static/mediaelementjs/mediaelement-and-player.min.js"></script> <link rel="stylesheet" href="static/mediaelementjs/mediaelementplayer.css" /> <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> {% endmacro %} diff --git a/templates/play.html b/templates/play.html index 1fd881a9d7d3f48f589a17e5f3e3fae11159ff3a..abb983f99e49076b5a8c93f1c2e2e22062a21dcc 100644 --- a/templates/play.html +++ b/templates/play.html @@ -2,6 +2,6 @@ {% extends "base.html" %} {% block content %} <div> - {{ player() }} + {{ player(lecture, videos) }} </div> {% endblock %}