diff --git a/config.py.example b/config.py.example index e6fbed4dbcd23f4e19569a5bc04a0ac9d04c603a..3984b4d2fde3df3c7add0c2794ca63d8ea7b7247 100644 --- a/config.py.example +++ b/config.py.example @@ -11,6 +11,7 @@ DB_DATA = 'db_example.sql' #DB_ENGINE = 'mysql' #MYSQL_HOST = 'localhost' #MYSQL_USER = 'videoag' +#MYSQL_PORT = 3306 #MYSQL_PASSWD = 'somuchsecret' #MYSQL_DB = 'videos' diff --git a/db.py b/db.py index b062972c19e9fc517985e6f29acd1500b567e060..dbec2ae06e8414d967e838f9f419f380f4533330 100644 --- a/db.py +++ b/db.py @@ -47,7 +47,7 @@ elif config['DB_ENGINE'] == 'mysql': def get_dbcursor(): if 'db' not in g or not g.db.is_connected(): - g.db = mysql.connector.connect(user=config['MYSQL_USER'], password=config['MYSQL_PASSWD'], host=config['MYSQL_HOST'], database=config['MYSQL_DB']) + g.db = mysql.connector.connect(user=config['MYSQL_USER'], password=config['MYSQL_PASSWD'], host=config['MYSQL_HOST'], port=config['MYSQL_PORT'], database=config['MYSQL_DB']) if not hasattr(request, 'db'): request.db = g.db.cursor() return request.db diff --git a/server.py b/server.py index 1f0404924516ab5670c17105e5e9e27936e68c94..a664a9b465d072be08f7b81882f2d80e1d52fab4 100644 --- a/server.py +++ b/server.py @@ -629,6 +629,22 @@ def sitemap(): return Response(render_template('sitemap.xml', pages=pages), 200, {'Content-Type': 'application/atom+xml'} ) + +@app.route('/site/') +@app.route('/site/<string:phpfile>') +def legacy(phpfile=None): + if phpfile=='embed.php' and ('lecture' in request.args): + return redirect(url_for('embed', id=request.args['lecture']),code=302) + if phpfile=='feed.php' and ('all' in request.args): + return redirect(url_for('feed'),code=302) + if phpfile=='feed.php' and ('newcourses' in request.args): + return redirect(url_for('courses_feed'),code=302) + if phpfile=='feed.php': + return redirect(url_for('feed', handle=request.args.copy().popitem()[0]),code=302) + print("Unknown legacy url:",request.url) + return redirect(url_for('index'),code=302) + + import feeds import importer import stats diff --git a/templates/base.html b/templates/base.html index 69f4c3f38bb8ab556c5eca02674ac51d9f437ec9..bf54ae125b7a5893d2d8a98439eace3f03b56f37 100644 --- a/templates/base.html +++ b/templates/base.html @@ -131,7 +131,7 @@ <div class="container-fluid"> <ul class="list-inline" style="margin-top: 5px;"> <li> - <a href="http://www.fsmpi.rwth-aachen.de/">Fachschaft I/1</a> + <a href="https://www.fsmpi.rwth-aachen.de/">Fachschaft I/1</a> </li> <li> <a href="http://www.vampir.rwth-aachen.de/">Vampir e.V.</a> @@ -140,7 +140,7 @@ <a href="https://www.youtube.com/channel/UCxh5snRN7yZyBsytNbGNuEQ">Youtube</a> </li> <li> - <a href="#">Facebook</a> + <a href="https://www.facebook.com/videoag">Facebook</a> </li> <li> <a href="https://twitter.com/rwthvideo">Twitter</a> diff --git a/templates/macros.html b/templates/macros.html index 8550225e1983b2a15b88b77ba2a61faaadf4a243..a7de6566a945f814e5d51c8f9ac53830d90e1281 100644 --- a/templates/macros.html +++ b/templates/macros.html @@ -55,6 +55,29 @@ $('#videoplayer').addClass("vjs-16-9"); $('#videoplayer').css("width"); $(function() { + //resume + var progress_key = "progress_{{ lecture.id }}"; + var seconds_played; + if (localStorage) { + seconds_played = localStorage.getItem(progress_key); + if (!seconds_played) { + seconds_played = 0; + } else { + videojs('videoplayer').currentTime(seconds_played); + } + } + videojs("videoplayer").on("timeupdate", function() { + if (localStorage) { + var player_cur_Time = Math.round(videojs("videoplayer").currentTime()); + if(Math.abs(player_cur_Time - seconds_played) >= 10) { + seconds_played = player_cur_Time; + localStorage.setItem( progress_key , seconds_played) + } + } + + }); + + //autoplay var playerplay = function() { if ($('#videoplayer').data("wasnotplayed") == 1) { videojs('videoplayer').play();