Commit 1ec90e26 authored by Julian Rother's avatar Julian Rother

Added timestamp formatting filter "time_offset" and increased rss feed compatability

parent f55e474f
......@@ -156,6 +156,10 @@ def human_time(d):
def rfc3339(d):
return d.strftime('%Y-%m-%dT%H:%M:%S+02:00')
@app.template_filter()
def time_offset(s):
return '%02d:%02d:%02d'%(s//3600, (s//60)%60, s%60)
@app.template_filter()
def rfc822(d):
return formatdate(mktime(d.timetuple()))
......
......@@ -12,7 +12,7 @@
{%- if chapters|selectattr('lecture_id','equalto',item.id)|list %}
<ul>
{% for chapter in chapters|selectattr('lecture_id','equalto',item.id) %}
<li>{{ '%02d:%02d:%02d'|format( chapter.time//3600, (chapter.time//60)%60, chapter.time%60) }}: {{ chapter.text }}</li>
<li>{{ chapter.time|time_offset }}: {{ chapter.text }}</li>
{% endfor %}
</ul>
{% endif %}
......@@ -49,11 +49,11 @@
<dc:creator>{{ item.speaker|e }}</dc:creator>
{% endif %}
{% if item.video.duration > 0 %}
<itunes:duration>{{ item.video.duration }}</itunes:duration>
<itunes:duration>{{ item.video.duration|time_offset }}</itunes:duration>
{% endif %}
<psc:chapters xmlns:psc="http://podlove.org/simple-chapters" version="1.2">
{% for chapter in chapters|selectattr('lecture_id','equalto',item.id) %}
<psc:chapter start="{{ chapter.time }}" title="{{ chapter.text }}"/>
<psc:chapter start="{{ chapter.time|time_offset }}" title="{{ chapter.text }}"/>
{% endfor %}
</psc:chapters>
<enclosure url="{{ url_for('files', filename=item.video.path, _external=True) }}" length="{{ item.video.file_size }}" type="{{ format.mimetype }}"/>
......
......@@ -55,7 +55,7 @@
{% for c in chapters|sort(attribute='time') %}
<tr>
<td>
<a class="chapterlink" href="{{url_for('lecture', course=course.handle, id=lecture.id, t=c['time'])}}" data-seek-time="{{c['time']}}">{{ '%02d:%02d:%02d'|format( c['time']//3600, (c['time']//60)%60, c['time']%60) }}</a>
<a class="chapterlink" href="{{url_for('lecture', course=course.handle, id=lecture.id, t=c['time'])}}" data-seek-time="{{c['time']}}">{{ c.time|time_offset }}</a>
<br>
{% if ismod() %}
{{ moderator_editor(['chapters',c.id,'time'],c['time'],true) }}
......
......@@ -358,7 +358,7 @@ $('#embedcodebtn').popover(
{% endmacro %}
{% macro vtttime(time) %}{{ '%02d:%02d:%02d.000'|format( time//3600, (time//60)%60, time%60) }}{% endmacro %}
{% macro vtttime(time) %}{{ time|time_offset }}.000{% endmacro %}
{% macro stats_viewsperday(id, req, title, type="scatter", param=None, maxtraces=7) %}
<script>
......
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