Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Video AG Infrastruktur
website
Commits
1ec90e26
Commit
1ec90e26
authored
Jan 03, 2018
by
Julian Rother
Browse files
Added timestamp formatting filter "time_offset" and increased rss feed compatability
parent
f55e474f
Changes
4
Hide whitespace changes
Inline
Side-by-side
template_helper.py
View file @
1ec90e26
...
...
@@ -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
()))
...
...
templates/feed.rss
View file @
1ec90e26
...
...
@@ -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 }}"
/>
...
...
templates/lecture.html
View file @
1ec90e26
...
...
@@ -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) }}
...
...
templates/macros.html
View file @
1ec90e26
...
...
@@ -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>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment