d8-podcast-ror/templates/podcast.html.twig
2023-03-04 18:58:42 +01:00

90 lines
3.8 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"
xmlns:podcast="https://podcastindex.org/namespace/1.0"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
version="2.0">
<channel>
<atom:link href="http://www.ondarossa.info{{ ror.url | escape("html_attr") }}" rel="self" type="application/rss+xml" />
{% if ror.expected_episodes_per_week > 1 %}
<ttl>30</ttl>
<sy:updatePeriod>hourly</sy:updatePeriod>
<sy:updateFrequency>6</sy:updateFrequency>
{% else %}
<ttl>360</ttl>
<sy:updatePeriod>daily</sy:updatePeriod>
<sy:updateFrequency>3</sy:updateFrequency>
{% endif %}
<skipHours>
<hour>1</hour>
<hour>2</hour>
<hour>3</hour>
<hour>4</hour>
<hour>5</hour>
<hour>6</hour>
</skipHours>
<title>{{ror.title}}</title>
<link>{{ror.link}}</link>
<language>it-it</language>
<itunes:subtitle>La radio di chi se la sente</itunes:subtitle>
<itunes:author>Ondarossa</itunes:author>
<itunes:summary>{{ror.description}}</itunes:summary>
<description>{{ror.description}}</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.png" />
<itunes:type>episodic</itunes:type>
<itunes:category text="News">
<itunes:category text="Politics"/>
</itunes:category >
<podcast:funding url="http://www.ondarossa.info/sostieni">Sostieni ondarossa</podcast:funding>
{% for nid, node in ror.podcast.nodes %}
{% set num_audios = node.audio|length %}
{% for num, audio in node.audio %}
<item>
{% set img = node.img.0.uri %}
{% 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 node.tx != "" %}
{% set author = node.tx %}
{% else %}
{% set author = "Radio Onda Rossa" %}
{% endif %}
<title>{% if node.tx != "" %}[{{node.tx}}] {%endif%}{{node.title.0.value}}{% if num_audios > 1 %} ({{num+1}}/{{num_audios}}: {{audio.field_audio_link[0].title}}){% endif %}</title>
<itunes:summary>{{ node.summary | raw }}</itunes:summary>
<description> {{ node.body.0.value }} </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>
<podcast:alternateEnclosure default="true" type="audio/{{ext}}" rel="default" >
<podcast:source uri="{{ audiourl | escape('html_attr') }}" />
<podcast:source
uri="{{ audiourl | replace({"https://archive.org/": "https://archive.degenerazione.xyz/"}) | escape('html_attr') }}" />
</podcast:alternateEnclosure>
{% if img != "" %}
{% set img_ext = img|split('.')|last|lower|replace({jpg: 'jpeg'}) %}
<itunes:image href="{{node.img.0.uri}}" type="image/{{img_ext}}" />
{% endif %}
<pubDate>{{ "@#{node.created.0.value}" | date("r") }}</pubDate>
<dc:creator><![CDATA[{{author}}]]></dc:creator>
<itunes:author><![CDATA[{{author}}]]></itunes:author>
<itunes:duration>{{"%02d" | format(duratahrs)}}:{{"%02d" | format(duratamin)}}:{{"%02d" | format(duratasec)}}</itunes:duration>
<itunes:explicit>no</itunes:explicit>
<guid>{{ audiourl }}@http://www.ondarossa.info{{node.path.0.alias}}@{{num}}</guid>
</item>
{% endfor %}
{% endfor %}
</channel>
</rss>