Commit a04fee6b authored by Julian Rother's avatar Julian Rother
Browse files

Added "video" featured type

parent 5b9d2060
...@@ -376,6 +376,21 @@ def index(): ...@@ -376,6 +376,21 @@ def index():
if item['param'] not in ['title', 'semester', 'organizer', 'subject']: if item['param'] not in ['title', 'semester', 'organizer', 'subject']:
continue continue
item['courses'] = query('SELECT * FROM courses WHERE (visible AND listed) AND `%s` = ? ORDER BY `%s`'%(item['param'], item['param']), item['param2']) 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']}
livestreams = 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"
WHERE streams.active AND streams.visible AND lectures.id = ?
''', item['param'])
item['videos'] = query('''
SELECT videos.*, "formats" AS sep, formats.*
FROM videos
JOIN formats ON (videos.video_format = formats.id)
WHERE videos.lecture_id = ? AND videos.visible
ORDER BY formats.prio DESC
''', item['param'])+genlive(livestreams)
return render_template('index.html', latestvideos=livestreams+latestvideos, upcomming=upcomming, featured=featured) return render_template('index.html', latestvideos=livestreams+latestvideos, upcomming=upcomming, featured=featured)
@app.route('/courses') @app.route('/courses')
......
...@@ -59,6 +59,7 @@ ...@@ -59,6 +59,7 @@
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li><a href="{{ url_for('create', table='featured', title='Neues Panel', type='plain', ref=request.url) }}">Nur Text</a></li> <li><a href="{{ url_for('create', table='featured', title='Neues Panel', type='plain', ref=request.url) }}">Nur Text</a></li>
<li><a href="{{ url_for('create', table='featured', title='Neues Panel', type='image', ref=request.url) }}">Text mit Bild</a></li> <li><a href="{{ url_for('create', table='featured', title='Neues Panel', type='image', ref=request.url) }}">Text mit Bild</a></li>
<li><a href="{{ url_for('create', table='featured', title='Neues Panel', type='video', ref=request.url) }}">Text mit Video</a></li>
<li><a href="{{ url_for('create', table='featured', title='Neues Panel', type='courses', param='semester', param2='', ref=request.url) }}">Veranstaltungsliste</a></li> <li><a href="{{ url_for('create', table='featured', title='Neues Panel', type='courses', param='semester', param2='', ref=request.url) }}">Veranstaltungsliste</a></li>
</ul> </ul>
</div> </div>
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
{% endmacro %} {% endmacro %}
{% macro player(lecture, videos, msgs) %} {% macro player(lecture, videos, msgs=[], autoplay=True) %}
<video id="videoplayer" style="width: 100%" class="video-js vjs-default-skin vjs-big-play-centered" width="640" height="320" controls data-wasnotplayed="1" data-setup='{ "language":"de", "plugins" : {"hotkeys": {"seekStep": 15, "enableVolumeScroll": false, "alwaysCaptureHotkeys": true}, "videoJsResolutionSwitcher": { "ui": true, "default": "720p", "dynamicLabel": false } }, "customControlsOnMobile": true, "playbackRates": [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 2.25, 2.5, 2.75, 3, 3.25, 3.5, 3.75, 4] }'> <video id="videoplayer" style="width: 100%" class="video-js vjs-default-skin vjs-big-play-centered" width="640" height="320" controls data-wasnotplayed="1" data-setup='{ "language":"de", "plugins" : {"hotkeys": {"seekStep": 15, "enableVolumeScroll": false, "alwaysCaptureHotkeys": true}, "videoJsResolutionSwitcher": { "ui": true, "default": "720p", "dynamicLabel": false } }, "customControlsOnMobile": true, "playbackRates": [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 2.25, 2.5, 2.75, 3, 3.25, 3.5, 3.75, 4] }'>
{% for v in videos|sort(attribute='formats.player_prio', reverse=True) %} {% for v in videos|sort(attribute='formats.player_prio', reverse=True) %}
<source type="{{ v.formats.mimetype }}" src="{{ config.VIDEOPREFIX }}/{{ v.path }}" data-label="{{ v.formats.description }}" data-res="{{v.formats.resolution}}" data-aspect="{{v.formats.aspect}}" data-player_prio="{{v.formats.player_prio}}"/> <source type="{{ v.formats.mimetype }}" src="{{ config.VIDEOPREFIX }}/{{ v.path }}" data-label="{{ v.formats.description }}" data-res="{{v.formats.resolution}}" data-aspect="{{v.formats.aspect}}" data-player_prio="{{v.formats.player_prio}}"/>
...@@ -90,10 +90,12 @@ $(function() { ...@@ -90,10 +90,12 @@ $(function() {
$('#videoplayer').data("wasnotplayed","0"); $('#videoplayer').data("wasnotplayed","0");
} }
}; };
{% if autoplay %}
$(window).focus(playerplay); $(window).focus(playerplay);
if (document.hasFocus()) { if (document.hasFocus()) {
playerplay(); playerplay();
} }
{% endif %}
// errors as modal dialog // errors as modal dialog
videojs("videoplayer").on("error", function() { videojs("videoplayer").on("error", function() {
var modals = []; var modals = [];
...@@ -401,6 +403,17 @@ $('#embedcodebtn').popover( ...@@ -401,6 +403,17 @@ $('#embedcodebtn').popover(
{% endif %} {% endif %}
Die vollständige Liste findest du <a href="{{ url_for('courses') }}">hier</a>. Die vollständige Liste findest du <a href="{{ url_for('courses') }}">hier</a>.
</div> </div>
{% elif item.type == 'video' %}
<div class="panel-body">
<div>{{ moderator_editor(('featured',item.id,'text'), item.text) }}</div>
{% if item.videos %}
{{ player(item.lecture, item.videos, autoplay=False)}}
{% endif %}
{% if ismod() %}
<div>ID des Videos: {{ moderator_editor(('featured',item.id,'param'), item.param) }}</div>
{% endif %}
<div>{{ moderator_editor(('featured',item.id,'param2'), item.param2) }}</div>
</div>
{% else %} {% else %}
{% if item.text or ismod() %} {% if item.text or ismod() %}
<div class="panel-body">{{ moderator_editor(('featured',item.id,'text'), item.text) }}</div> <div class="panel-body">{{ moderator_editor(('featured',item.id,'text'), item.text) }}</div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment