Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
W
website
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
84
Issues
84
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
1
Merge Requests
1
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Video AG Infrastruktur
website
Commits
1ec90e26
Commit
1ec90e26
authored
Jan 03, 2018
by
Julian Rother
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added timestamp formatting filter "time_offset" and increased rss feed compatability
parent
f55e474f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
5 deletions
+9
-5
template_helper.py
template_helper.py
+4
-0
templates/feed.rss
templates/feed.rss
+3
-3
templates/lecture.html
templates/lecture.html
+1
-1
templates/macros.html
templates/macros.html
+1
-1
No files found.
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
Markdown
is supported
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