d8-podcast-ror/templates/podcast.html.twig
2019-11-26 10:28:07 +01:00

56 lines
2.5 KiB
Twig

<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
<channel>
<atom:link href="http://www.ondarossa.info{{ ror.url | escape("html_attr") }}" rel="self" type="application/rss+xml" />
<title>Radio Onda Rossa</title>
<link>http://www.ondarossa.info</link>
<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 %}
{% set num_audios = node.audio|length %}
{% for num, audio in node.audio %}
<item>
{% set audiourl = audio.field_audio_link[0].uri %}
{% set ext = audiourl|split('.')|last %}
{% set durata = audio.field_durata[0].value %}
{% set duratahrs = durata // 3600 %}
{% set duratamin = (durata // 60) % 60 %}
{% set duratasec = durata % 60 %}
{% if num_audios > 1 %}
<title> {{node.title.0.value}} ({{num+1}}/{{num_audios}}: {{audio.field_audio_link[0].title}}) </title>
{% else %}
<title> {{node.title.0.value}} </title>
{% endif %}
<itunes:summary>{{ node.summary | raw }}</itunes:summary>
<description> {{ node.body.0.value }}
{# [fields]
{% for field in node.img.0|keys %}
[[ {{ field}}{{"\t"}}-> `{{node.img.0[field]}}` ]]
{% endfor %}
[/fields] #}
</description>
<link>http://www.ondarossa.info{{node.path.0.alias}}</link>
<enclosure url="{{ audiourl | replace({"https://": "http://"}) | escape('html_attr') }}" type="audio/{{ext}}" length="1024"></enclosure>
<pubDate>{{ "@#{node.created.0.value}" | date("r") }}</pubDate>
<itunes:author>Redazione Ondarossa</itunes:author>
<itunes:duration>{{"%02d" | format(duratahrs)}}:{{"%02d" | format(duratamin)}}:{{"%02d" | format(duratasec)}}</itunes:duration>
<itunes:explicit>no</itunes:explicit>
<guid>{{ audiourl }}</guid>
</item>
{% endfor %}
{% endfor %}
</channel>
</rss>