Last active
December 7, 2016 20:15
-
-
Save eteubert/577c4da560c7a615054dd6fb1fe79826 to your computer and use it in GitHub Desktop.
Template für Podlove Podcast Publisher. Gesamtdauer aller Episoden.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% set total = 0 %} | |
{% for episode in podcast.episodes %} | |
{% set total = total + episode.duration.totalMilliseconds %} | |
{% endfor %} | |
{# // is division and then rounding down (floor) #} | |
{% set hours = total // (1000 * 3600) %} | |
{% set minutes = (total // (1000 * 60)) % 60 %} | |
{% set seconds = (total // 1000) % 60 %} | |
{% if hours < 10 %} | |
{% set hours = "0" ~ hours %} | |
{% endif %} | |
{% if minutes < 10 %} | |
{% set minutes = "0" ~ minutes %} | |
{% endif %} | |
{% if seconds < 10 %} | |
{% set seconds = "0" ~ seconds %} | |
{% endif %} | |
Gesamtdauer aller {{ podcast.episodes|length }} Episoden: {{ hours }} Stunden {{ minutes }} Minuten {{ seconds }} Sekunden |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Dankeschön :)