d8-podcast-ror/templates/podcast.html.twig

50 lines
2 KiB
Twig
Raw Normal View History

2018-09-14 16:43:38 +02:00
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
<channel>
<title>Radio Onda Rossa</title>
<language>it-it</language>
<itunes:subtitle>La radio di chi se la sente</itunes:subtitle>
<itunes:author>Ondarossa</itunes:author>
<itunes:summary>Podcast completo</itunes:summary>
<description>Tutti gli aggiornamenti, i redazionali, le trasmissioni della radio di chi se la sente</description>
<itunes:owner>
<itunes:name>Ondarossa</itunes:name>
<itunes:email>ondarossa@ondarossa.info</itunes:email>
</itunes:owner>
<itunes:explicit>no</itunes:explicit>
<itunes:image href="http://www.ondarossa.info/favicon.ico" />
<itunes:category text="News &amp; Politics"/>
{% for nid, node in ror.podcast.nodes %}
<item>
{% for num, audio in ror.podcast.audio[nid] %}
{% set audiourl = audio.field_audio_link[0].uri %}
{% set ext = audiourl|split('.')|last %}
{% set durata = audio.field_durata[0].value %}
{% set duratamin = durata // 60 %}
{% set duratasec = durata % 60 %}
<title> {{node.getTitle()}} </title>
<itunes:summary>Description of podcast episode content</itunes:summary>
<description> {{ node.get('body').getValue().0.value }} </description>
<link>http://example.com/podcast-1</link> {# node.getLink#}
{# TODO: detect ogg/mp3 #}
<enclosure url="{{ audiourl }}" type="audio/{{ext}}" length="1024"></enclosure>
{# TODO: formatta pubDate #}
<pubDate>Thu, 21 Dec 2016 16:01:07 +0000</pubDate>
<itunes:author>Redazione Ondarossa</itunes:author>
<itunes:duration>00:{{"%02d" | format(duratamin)}}:{{"%02d" | format(duratasec)}}</itunes:duration>
<itunes:explicit>no</itunes:explicit>
<guid>{{ audiourl }}</guid>
{% endfor %}
{# [fields]
{% for field in node.getFields() %}
[[ {{ field.getName() }} ]]
{% endfor %}
[/fields] #}
</item>
{% endfor %}
</channel>
</rss>