This commit is contained in:
Florian Maury 2024-10-21 08:50:06 +02:00
parent 44190c8913
commit bd18ab9792
17 changed files with 462 additions and 88 deletions

View file

@ -4,7 +4,8 @@ description: "" # podcast field: description
date: {{ .Date }} # podcast field: pubDate date: {{ .Date }} # podcast field: pubDate
outputs: outputs:
- html - html
- json - chapters
type: episode
params: params:
enclosure: enclosure:
resource_file: "" # name of the resource in the episode directory resource_file: "" # name of the resource in the episode directory
@ -15,6 +16,7 @@ params:
- sources: # one of resource_file or external_url per item - sources: # one of resource_file or external_url per item
- resource_file: "" # name of the resource in the episode directory - resource_file: "" # name of the resource in the episode directory
external_url: "" # URL to download that enclosure external_url: "" # URL to download that enclosure
type: "" # content type
sri_hash: "" # SRI hash of the file to download sri_hash: "" # SRI hash of the file to download
type: "" # MIME type of that enclosure type: "" # MIME type of that enclosure
length: 0 # optional/recommended; byte length of the file to download length: 0 # optional/recommended; byte length of the file to download
@ -27,11 +29,27 @@ params:
# image: "" # podcast field: itunes:image ; image for the episode # image: "" # podcast field: itunes:image ; image for the episode
# explicit: false # podcast field: itunes:explicit # explicit: false # podcast field: itunes:explicit
# episode_number: 0 # podcast field: itunes:episode ; the number of the episode in the series/season # episode_number: 0 # podcast field: itunes:episode ; the number of the episode in the series/season
# season: 0 # podcast field: itunes:season ; the number of the season # season: # podcast field: itunes:season
# number: 0 # the number of the season
# title: ""
# episode_type: "" # podcast field: itunes:episodeType ; one of "Full", "Trailer" or "Bonus" # episode_type: "" # podcast field: itunes:episodeType ; one of "Full", "Trailer" or "Bonus"
# transcript: # podcast field: podcast:transcript # transcript: # podcast field: podcast:transcript
# - url: "" # URL to the transcript file # - formats
# type: "" # one of text/vtt, application/srt, text/html, application/json or application/x-subrip or text/plain # srt:
# external_url: "" # URL to the transcript file
# resource_file: "" # URL to the transcript file
# webvtt:
# external_url: "" # URL to the transcript file
# resource_file: "" # URL to the transcript file
# json:
# external_url: "" # URL to the transcript file
# resource_file: "" # URL to the transcript file
# html:
# external_url: "" # URL to the transcript file
# resource_file: "" # URL to the transcript file
# podlove:
# external_url: "" # URL to the transcript file
# resource_file: "" # URL to the transcript file
# language: fr # optional; if omitted, language is the same as the podcast language attribute # language: fr # optional; if omitted, language is the same as the podcast language attribute
# rel: "captions" # ; optional ; only valid value is "captions"; indicates that this transcript contains time codes # rel: "captions" # ; optional ; only valid value is "captions"; indicates that this transcript contains time codes
# funding: # podcast field: podcast:funding # funding: # podcast field: podcast:funding
@ -50,6 +68,7 @@ params:
# soundbites: # podcast field: podcast:soundbite # soundbites: # podcast field: podcast:soundbite
# - start_time: 0.0 # expressed in seconds since the start of the episode # - start_time: 0.0 # expressed in seconds since the start of the episode
# duration: 0.0 # duration: 0.0
# title: ""
# persons: # podcast field: podcast:person ; description and links to a podcast participant # persons: # podcast field: podcast:person ; description and links to a podcast participant
# - name: Florian Maury # - name: Florian Maury
# href: https://infosec.exchange/@x_cli # href: https://infosec.exchange/@x_cli

83
archetypes/podcast.md Normal file
View file

@ -0,0 +1,83 @@
---
title: "" # podcast field: title
description: "" # podcast field: description
draft: false
date: "2024-10-11T00:00:01Z"
type: podcast
outputs:
# - html
- rss
params:
guid: "" # podcast field: podcast:guid
lang: "" # podcast field: language ; from ISO 639
# platforms:
# - name: apple # one of https://github.com/Podcastindex-org/podcast-namespace/blob/main/serviceslugs.txt
# url: "" # URL the podcast on that platform
image: # podcast field: itunes:image ; URL to an image representing the podcast
resource_file: ""
external_url: ""
# images: # podcast field: podcast:images ; multiple images with various width
# - resource_file: "" # name of the resource in the podcast directory
# external_url: "" # absolute external URL to the image hosted elsewhere
# width: 0 # width of the image
category: "" # podcast field: itunes:category ; one of https://github.com/Podcastindex-org/podcast-namespace/blob/main/categories.json
explicit: false # podcast field: itunes:explicit
email: "" # used in podcast:locked and itunes:owner => itunes:email
medium: podcast # podcast field: podcast:medium ; one of https://github.com/Podcastindex-org/podcast-namespace/blob/main/docs/1.0.md#medium
website_link: "" # podcast field: link ; a link to the podcast website
podcast_type: episodic # podcast field: itunes:type ; either episodic or serial
# copyright: "" # podcast field: copyright
# licence: # podcast field: podcast:licence
# name: CC-BY 4.0
# url: https://creativecommons.org/licenses/by/4.0/
locked: true # podcast field: podcast:locked; control whether the podcast can be imported by platforms
use_op3: true # Whether to use op3 redirection for gathering statistics
# funding: # podcast field: podcast:funding
# - url: "bli" # URL to the funding method
# comment: "bla" # name of the funding method or message to encourage funding; limited to 128 chars
# recommendations: # podcast field: podcast:recommendations
# - url: https://pod.broken-by-design.fr/recommendations.fr.json
# language: fr
# location: # podcast field: podcast:location ; used to associate the podcast or the episode to a specific location
# description: "" # Description of the place (128 chars max)
# geo: "" # lattitude and longitude expressed in "geo" notation
# osm: "" # Open Street Map Identifier
# trailer: # podcast field: podcast:trailer ; used to provider one or more trailers for the podcast or seasons
# - resource_file: "" # resource identifier
# external_url: "" # URL to the audio file
# title: "" # Title of the trailer; max 128 chars
# pubdate: "" # date in RFC 2822 format
# length: 0 # byte length of the file
# type: "" # mime type of the file
# season: 0 # season number if this trailer is for a specific season; 0 means that the trailer is for the podcast as a whole
# social_interacts: # podcast field: podcast:socialInteracts ; links to interact on social media with the podcast
# - protocol: activitypub # one of https://github.com/Podcastindex-org/podcast-namespace/blob/main/socialprotocols.txt
# uri: "" # URL of the root post for the channel as a whole
# priority: 10
# podroll: # podcast field: podcast:podroll
# - feed_guid: "" # guid of the other podcast
# feed_url: "" # URL of the other podcast if guid is not resolvable
# medium: podcast # same indications that the medium parameter
# title: "" # name of the other podcast
# remote_items:
# - feed_guid: "" # guid of the other podcast
# feed_url: "" # URL of the other podcast if guid is not resolvable
# medium: podcast # same indications that the medium parameter
# title: "" # name of the other podcast
# update_frequency:
# rrule: "" # see rule syntax here https://www.rfc-editor.org/rfc/rfc5545#section-3.3.10
# dtstart: "" # date formated as ISO8601 where the reccurrence begins
# complete: false # whether no new episodes are expected
# description: "" # description of the frequency in natural language
cascade:
params:
author: Florian Maury # podcast field: itunes:author and itunes:owner => itunes:name
# persons: # podcast field: podcast:person ; description and links to a podcast participant
# - name: Florian Maury
# href: https://infosec.exchange/@x_cli
# image:
# resource_file: "florian.png" # resource identifier ; resource must be in global assets, not page bundles
# external_url: "" # url to avatar
# group: Cast # as listed in https://github.com/Podcastindex-org/podcast-namespace/blob/main/taxonomy.json
# role: Host
---

12
archetypes/season.md Normal file
View file

@ -0,0 +1,12 @@
---
title: ""
description: ""
date: "2024-10-11T00:00:00Z"
draft: false
type: season
cascade:
params:
season:
number: 0
title: ""
---

View file

@ -2,3 +2,5 @@ season: season
seasons: seasons seasons: seasons
episode: episode episode: episode
episodes: episodes episodes: episodes
welcome: Welcome on the %s podcast!
colon: ":"

View file

@ -2,3 +2,5 @@ season: saison
seasons: saisons seasons: saisons
episode: épisode episode: épisode
episodes: épisodes episodes: épisodes
welcome: Bienvenue sur le podcast %s !
colon: " :"

View file

@ -0,0 +1,6 @@
{
"version": "1.2.0",
"chapters":
[
]
}

View file

@ -0,0 +1,17 @@
{{- $ctx := collections.Index . "context" -}}
{{- $episode_page := collections.Index . "episode_page" -}}
{{- $guid := collections.Index . "guid" -}}
{{- $use_op3 := collections.Index . "use_op3" -}}
{{- $url := partial "external_or_local.rss.xml" (dict "context" $ctx "ref_page" $episode_page) -}}
{{- if $use_op3 -}}
{{- $parsedURL := urls.Parse $url -}}
{{- if eq $parsedURL.Scheme "http" -}}
{{- $url = printf "https://op3.dev/e,pg=%s/http://%s%s" $guid $parsedURL.Host $parsedURL.RequestURI -}}
{{- else -}}
{{- $url = printf "https://op3.dev/e,pg=%s/%s%s" $guid $parsedURL.Host $parsedURL.RequestURI -}}
{{- end -}}
{{- if $parsedURL.Fragment -}}
{{- $url = printf "%s#%s" $url $parsedURL.Fragment -}}
{{- end -}}
{{- end -}}
{{- return $url -}}

View file

@ -0,0 +1,15 @@
{{- $ctx := collections.Index . "context" -}}
{{- $ref_page := collections.Index . "ref_page" -}}
{{- $url := "" -}}
{{- with collections.Index $ctx "external_url" -}}
{{- $url = . -}}
{{- else -}}
{{- $resource_file := collections.Index $ctx "resource_file" -}}
{{- with $ref_page.Resources.Get $resource_file -}}
{{- $url = .Permalink -}}
{{- else -}}
{{- errorf "failed to load resource file %q for page %q" $resource_file $ref_page.Title -}}
{{- end -}}
{{- end -}}
{{- return $url -}}

View file

@ -0,0 +1,16 @@
{{- $indent := collections.Index . "indent" -}}
{{- $ctx := collections.Index . "context" -}}
{{- with $ctx.Params.images -}}
{{- $image_url_list := slice -}}
{{- range . -}}
{{- $entry := . -}}
{{- $url := partial "external_or_local.rss.xml" (dict "context" . "ref_page" $ctx) -}}
{{- $width := collections.Index $entry "width" -}}
{{- $attr := printf "%s %sw" $url $width | transform.XMLEscape -}}
{{- $image_url_list = append $attr $image_url_list -}}
{{- end -}}
{{- strings.Repeat $indent " " -}}
<podcast:images srcset="{{- delimit $image_url_list "," -}}" />
{{- "\n" -}}
{{- end -}}

View file

@ -0,0 +1,9 @@
{{- $indent := collections.Index . "indent" -}}
{{- $ctx := collections.Index . "context" -}}
{{- with $ctx.Params.licence -}}
{{- strings.Repeat $indent " " -}}
<podcast:licence url="{{- .url | transform.XMLEscape -}}">
{{- .name | transform.XMLEscape -}}
</podcast:licence>
{{- "\n" -}}
{{- end -}}

View file

@ -0,0 +1,7 @@
{{- $indent := collections.Index . "indent" -}}
{{- $ctx := collections.Index . "context" -}}
{{- with $ctx.Params.location -}}
{{- strings.Repeat $indent " " -}}
<podcast:location geo="{{ collections.Index . "geo" | transform.XMLEscape }}" osm="{{ collections.Index . "osm" | transform.XMLEscape }}">{{ collections.Index . "description" | transform.XMLEscape }}</podcast:location>
{{- "\n" -}}
{{- end -}}

View file

@ -0,0 +1,27 @@
{{- $ctx := collections.Index . "context" -}}
{{- $indent := collections.Index . "indent" -}}
{{- $start_time := collections.Index $ctx "start_time" -}}
{{- $title := collections.Index $ctx "title" -}}
{{- $start_time_ms := math.Floor (math.Mul $start_time 1000) -}}
{{- $time_str := "" -}}
{{- $hour_cnt := math.Div $start_time_ms 3600000 -}}
{{- $rem := math.Mod $start_time_ms 3600000 -}}
{{- if compare.Gt $hour_cnt 0 -}}
{{- $time_str = printf "%02d:" $hour_cnt -}}
{{- end -}}
{{- $min_cnt := math.Div $rem 60000 -}}
{{- $rem = math.Mod $rem 60000 -}}
{{- if compare.Or $time_str (compare.Gt $min_cnt 0) -}}
{{- $time_str = printf "%s%02d:" $time_str $min_cnt -}}
{{- end -}}
{{- $sec_cnt := math.Div $rem 1000 -}}
{{- $time_str = printf "%s%02d:" $time_str $sec_cnt -}}
{{- $ms_cnt := math.Mod $rem 1000 -}}
{{- if compare.Gt $ms_cnt 0 -}}
{{- $time_str = printf "%s.%03d" $ms_cnt -}}
{{- end -}}
{{- strings.Repeat $indent " " -}}
<psc:chapter start="{{- $time_str -}}" title="{{- $title -}}" />
{{- "\n" -}}

View file

@ -0,0 +1,15 @@
{{- $indent := collections.Index . "indent" -}}
{{- $ctx := collections.Index . "context" -}}
{{- range $ctx -}}
{{- strings.Repeat $indent " " -}}
<podcast:remoteItem
{{- " " | safe.HTMLAttr -}}
feedGuid="{{- collections.Index . "feed_guid" -}}"
{{- " " | safe.HTMLAttr -}}
feedUrl="{{- collections.Index . "feed_url" -}}"
{{- " " | safe.HTMLAttr -}}
medium="{{- collections.Index . "medium" -}}"
{{- " " | safe.HTMLAttr -}}
title="{{- collections.Index . "title" -}}" />
{{- "\n" -}}
{{- end -}}

View file

@ -0,0 +1,24 @@
{{- $resource := collections.Index . "resource" -}}
{{- $type := collections.Index . "type" -}}
{{- $lang := collections.Index . "lang" -}}
{{- $rel := collections.Index . "rel" -}}
{{- $episode_page := collections.Index . "episode_page" -}}
{{- $indent := collections.Index . "indent" -}}
{{- $url := partial "external_or_local.rss.xml" (dict "context" $resource "ref_page" $episode_page) -}}
{{- strings.Repeat $indent " " -}}
<podcast:transcript url="{{- $url | transform.XMLEscape -}}" type="{{- . | transform.XMLEscape -}}"
{{- with $lang -}}
{{- " " | safe.HTMLAttr -}}
language="{{- . | transform.XMLEscape -}}"
{{- end -}}
{{- with collections.Index . "rel" -}}
{{- " " | safe.HTMLAttr -}}
rel="{{- . | transform.XMLEscape -}}"
{{- end -}}
{{- " " | safe.HTMLAttr -}}
/>
{{- "\n" -}}

View file

@ -1,9 +1,25 @@
Podcast {{ .Title }} <h1>{{ printf (T "welcome") .Title }}</h1>
{{ range .Sections }} {{- $season_cnt := 0 -}}
<p><a href="{{ .RelPermalink }}">{{ .Title}}</a></p> {{- $season_lst := slice -}}
{{ end }} {{- range .Sections -}}
{{- if eq .Type "season" -}}
{{ T "episodes" | strings.FirstUpper }} : {{- $season_cnt = add $season_cnt 1 -}}
{{ range .RegularPagesRecursive.ByParam "season" }} {{- $season_lst = collections.Append (dict "number" .Params.season.number "title" .Params.season.title "object" .) $season_lst -}}
<p>{{ if .Params.season }}Season {{ .Params.season }} : {{ end }} {{ .Title }}</p> {{- end -}}
{{- end -}}
{{- if gt $season_cnt 0 -}}
<h2>{{- T "seasons" | strings.FirstUpper -}}</h2>
{{- $season_lst = collections.Sort $season_lst "number" "asc" -}}
{{- end -}}
{{- range $season_lst -}}
<p><a href="{{- (collections.Index . "object").RelPermalink -}}">{{- printf "%s %d%s %s" (T "season" | strings.FirstUpper) (collections.Index . "number") (T "colon") (collections.Index . "title") -}}</a></p>
{{- end -}}
{{- printf "%s%s" (T "episodes" | strings.FirstUpper ) (T "colon") -}}
{{ range .RegularPagesRecursive }}
<p><a href="{{- .RelPermalink -}}">
{{- if .Params.season -}}
{{- printf "%s %d%s " (T "season" | strings.FirstUpper) (collections.Index .Params.season "number") (T "colon") -}}
{{- end -}}
{{- .Title -}}
</a></p>
{{ end }} {{ end }}

View file

@ -1,5 +1,7 @@
{{- $use_op3 := .Params.use_op3 -}}
{{- $guid := .Params.guid -}}
{{- $podcast_type := "" -}} {{- $podcast_type := "" -}}
{{- /* Either external_url or resource_file must be defined; use external_url if it is defined. If not, get the resource designated by the resource_file paramter. The resource identifier must be relative to the podcast directory */ -}} {{- /* Either external_url or resource_file must be defined; use external_url if it is defined. If not, get the resource designated by the resource_file parameter. The resource identifier must be relative to the podcast directory */ -}}
{{- $image := "" -}} {{- $image := "" -}}
{{- if collections.Index .Params.image "external_url" -}} {{- if collections.Index .Params.image "external_url" -}}
{{- collections.Index .Params.image "external_url" | transform.XMLEscape -}} {{- collections.Index .Params.image "external_url" | transform.XMLEscape -}}
@ -127,44 +129,15 @@
{{- "\n" -}} {{- "\n" -}}
{{- end -}} {{- end -}}
{{- with .Params.licence -}} {{- partial "licence.rss.xml" (dict "context" . "indent" $indent) -}}
{{- strings.Repeat $indent " " -}}
<podcast:licence url="{{- .url | transform.XMLEscape -}}">
{{- .name | transform.XMLEscape -}}
</podcast:licence>
{{- "\n" -}}
{{- end -}}
{{- with .Params.images -}} {{- partial "images.rss.xml" (dict "context" . "indent" $indent) -}}
{{- $image_url_list := slice -}}
{{- range . -}}
{{- $entry := . -}}
{{- $url := "" -}}
{{- $width := collections.Index $entry "width" | transform.XMLEscape -}}
{{- with collections.Index $entry "resource_file" -}}
{{- $r := $.Resources.Get . -}}
{{- $url = $r.Permalink -}}
{{- else -}}
{{- $url = collections.Index $entry "external_url" | transform.XMLEscape -}}
{{- end -}}
{{- $attr := printf "%s %sw" $url $width -}}
{{- $image_url_list = append $attr $image_url_list -}}
{{- end -}}
{{- strings.Repeat $indent " " -}}
<podcast:images srcset="{{- delimit $image_url_list "," -}}" />
{{- "\n" -}}
{{- end -}}
{{- with .Params.funding -}} {{- with .Params.funding -}}
{{- partial "funding.rss.xml" (dict "context" . "indent" $indent) -}} {{- partial "funding.rss.xml" (dict "context" . "indent" $indent) -}}
{{- end -}} {{- end -}}
{{- with .Params.location -}} {{- partial "location.rss.xml" (dict "context" . "indent" $indent) -}}
{{- strings.Repeat $indent " " -}}
<podcast:location geo="{{ collections.Index . "geo" | transform.XMLEscape }}" osm="{{ collections.Index . "osm" | transform.XMLEscape }}">{{ collections.Index . "description" | transform.XMLEscape }}</podcast:location>
{{- "\n" -}}
{{- end -}}
{{- with .Params.trailer -}} {{- with .Params.trailer -}}
{{- range . -}} {{- range . -}}
@ -203,22 +176,15 @@
{{- with .Params.podroll -}} {{- with .Params.podroll -}}
{{- strings.Repeat $indent " " -}} {{- strings.Repeat $indent " " -}}
<podcast:podroll> <podcast:podroll>
{{- range . -}} {{- partial "remoteItems.rss.xml" (dict "context" . "indent" (add $indent 1)) -}}
<podcast:remoteItem
{{- " " -}}
feedGuid="{{- collections.Index . "feed_guid" -}}"
{{- " " -}}
feedUrl="{{- collections.Index . "feed_url" -}}"
{{- " " -}}
medium="{{- collections.Index . "medium" -}}"
{{- " " -}}
title="{{- collections.Index . "title" -}}" />
{{- "\n" -}}
{{- end -}}
</podcast:podroll> </podcast:podroll>
{{- "\n" -}} {{- "\n" -}}
{{- end -}} {{- end -}}
{{- with .Params.remote_items -}}
{{- partial "remoteItems.rss.xml" (dict "context" . "indent" $indent) -}}
{{- end -}}
{{- with .Params.update_frequency -}} {{- with .Params.update_frequency -}}
{{- strings.Repeat $indent " " -}} {{- strings.Repeat $indent " " -}}
<podcast:updateFrequency <podcast:updateFrequency
@ -227,10 +193,10 @@
complete="true" complete="true"
{{- else -}} {{- else -}}
{{- $dtstart := collections.Index . "dtstart" -}} {{- $dtstart := collections.Index . "dtstart" -}}
{{- " " -}} {{- " " | safe.HTMLAttr -}}
rrule="{{- collections.Index . "rrule" | transform.XMLEscape -}}" rrule="{{- collections.Index . "rrule" | transform.XMLEscape -}}"
{{- if $dtstart -}} {{- if $dtstart -}}
{{- " " -}} {{- " " | safe.HTMLAttr -}}
dtstart="{{- $dtstart | transform.XMLEscape -}}" dtstart="{{- $dtstart | transform.XMLEscape -}}"
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
@ -241,7 +207,7 @@
{{- end -}} {{- end -}}
{{- with .Params.recommendations -}} {{- with .Params.recommendations -}}
{{- partial "recommandations.rss.xml" (dict "context" . "indent" $indent) -}} {{- partial "recommendations.rss.xml" (dict "context" . "indent" $indent) -}}
{{- end -}} {{- end -}}
{{- with .Params.persons -}} {{- with .Params.persons -}}
@ -249,6 +215,7 @@
{{- end -}} {{- end -}}
{{- range .RegularPagesRecursive.ByDate.Reverse -}} {{- range .RegularPagesRecursive.ByDate.Reverse -}}
{{- $episode_page := . -}}
{{- $episode_title := .Title -}} {{- $episode_title := .Title -}}
{{- strings.Repeat $indent " " -}} {{- strings.Repeat $indent " " -}}
<item> <item>
@ -257,40 +224,31 @@
{{- strings.Repeat $indent " " -}} {{- strings.Repeat $indent " " -}}
<title> <title>
{{ .Title | transform.XMLEscape -}} #XXX when else errors {{- .Title | transform.XMLEscape -}}
</title> </title>
{{- "\n" -}} {{- "\n" -}}
{{- strings.Repeat $indent " " -}} {{- strings.Repeat $indent " " -}}
<guid> <guid>
{{- when .Params.guid -}} {{- with .Params.guid -}}
{{- . | transform.XMLEscape -}} {{- . | transform.XMLEscape -}}
{{- else -}} {{- else -}}
{{- errorf "missing required enclosure paramter for episode %q" $episode_title -}} {{- errorf "missing required guid parameter for episode %q" $episode_title -}}
{{- end -}} {{- end -}}
</guid> </guid>
{{- "\n" -}} {{- "\n" -}}
{{- with .Params.enclosure -}} {{- with .Params.enclosure -}}
{{- $url := "" -}} {{- $url := partial "enclosure_url.rss.xml" (dict "context" . "episode_page" $episode_page "guid" $guid "use_op3" $use_op3) -}}
{{- with collections.Index . "external_url" -}}
{{- $url = . -}}
{{- else -}}
{{- with collections.Index . "resource_file" | .Resource.Get -}}
{{- $url = .Permalink -}}
{{- else -}}
{{- errorf "failed to load resource file %q for episode %q" (collections.Index . "resource_file") $episode_title -}}
{{- end -}}
{{- end -}}
{{- strings.Repeat $indent " " -}} {{- strings.Repeat $indent " " -}}
<enclosure <enclosure
{{- " " -}} {{- " " | safe.HTMLAttr -}}
url="{{- $url | transform.XMLEscape -}}" url="{{- $url | transform.XMLEscape -}}"
{{- " " -}} {{- " " | safe.HTMLAttr -}}
type="{{- collections.Index $enclosure "type" | transform.XMLEscape -}}" type="{{- collections.Index . "type" | transform.XMLEscape -}}"
{{- " " -}} {{- " " | safe.HTMLAttr -}}
length="{{- collections.Index $enclosure "length" | transform.XMLEscape -}}" length="{{- collections.Index . "length" | transform.XMLEscape -}}"
{{- " " -}} {{- " " | safe.HTMLAttr -}}
/> />
{{- "\n" -}} {{- "\n" -}}
{{- else -}} {{- else -}}
@ -299,17 +257,19 @@
{{- strings.Repeat $indent " " -}} {{- strings.Repeat $indent " " -}}
<pubDate> <pubDate>
{{- .Time.Format "Mon, 02 Jan 2006 15:04:05 MST" | transform.XMLEscape -}} {{- .Date.Format "Mon, 02 Jan 2006 15:04:05 MST" | transform.XMLEscape -}}
</pubDate> </pubDate>
{{- "\n" -}} {{- "\n" -}}
{{- strings.Repeat $indent " " -}} {{- strings.Repeat $indent " " -}}
<description><![CDATA[ <description>
{{- "<![CDATA[" | safe.HTML -}}
{{- .Description | safe.HTML -}} {{- .Description | safe.HTML -}}
]]></description> {{- "]]>" | safe.HTML -}}
</description>
{{- "\n" -}} {{- "\n" -}}
{{- when .Params.duration -}} {{- with .Params.duration -}}
{{- strings.Repeat $indent " " -}} {{- strings.Repeat $indent " " -}}
<itunes:duration> <itunes:duration>
{{- . | transform.XMLEscape -}} {{- . | transform.XMLEscape -}}
@ -329,8 +289,8 @@
{{- $url = . -}} {{- $url = . -}}
{{- else -}} {{- else -}}
{{- $resource_file := collections.Index . "resource_file" -}} {{- $resource_file := collections.Index . "resource_file" -}}
{{- with .Resource.Get $resource_file -}} {{- with $episode_page.Resources.Get $resource_file -}}
{{- url = .Permalink -}} {{- $url = .Permalink -}}
{{- else -}} {{- else -}}
{{- errorf "failed to get resource %q for episode %q" $resource_file $episode_title -}} {{- errorf "failed to get resource %q for episode %q" $resource_file $episode_title -}}
{{- end -}} {{- end -}}
@ -365,14 +325,158 @@
{{- with .Params.season -}} {{- with .Params.season -}}
{{- strings.Repeat $indent " " -}} {{- strings.Repeat $indent " " -}}
<itunes:season> <itunes:season>
{{- . | transform.XMLEscape -}} {{- collections.Index . "number" | transform.XMLEscape -}}
</itunes:season> </itunes:season>
{{- "\n" -}} {{- "\n" -}}
{{- strings.Repeat $indent " " -}}
<podcast:season
{{- with collections.Index . "title" -}}
{{- " " | safe.HTMLAttr -}}
season="{{- . | transform.XMLEscape -}}"
{{- end -}}
>
{{- collections.Index . "number" | transform.XMLEscape -}}
</podcast:season>
{{- "\n" -}}
{{- end -}} {{- end -}}
{{- with .Params.episode_type -}}
{{- strings.Repeat $indent " " -}}
<itunes:episodeType>
{{- . | transform.XMLEscape -}}
</itunes:episodeType>
{{- "\n" -}}
{{- end -}}
{{- with .Params.alternate_enclosures -}}
{{- range . -}}
{{- strings.Repeat $indent " " -}}
<podcast:alternateEnclosure
{{- with collections.Index . "type" -}}
{{- " " | safe.HTMLAttr -}}
type="{{- . | transform.XMLEscape -}}"
{{- else -}}
{{- errorf "alternate enclosure missing required attribute type for episode %q: %q" $episode_title . -}}
{{- end -}}
{{- with collections.Index . "length" -}}
{{- " " | safe.HTMLAttr -}}
length="{{- . | transform.XMLEscape -}}"
{{- end -}}
{{- with collections.Index . "bitrate" -}}
{{- " " | safe.HTMLAttr -}}
bitrate="{{- . | transform.XMLEscape -}}"
{{- end -}}
{{- with collections.Index . "lang" -}}
{{- " " | safe.HTMLAttr -}}
lang="{{- . | transform.XMLEscape -}}"
{{- end -}}
{{- with collections.Index . "title" -}}
{{- " " | safe.HTMLAttr -}}
title="{{- . | transform.XMLEscape -}}"
{{- end -}}
{{- with collections.Index . "codecs" -}}
{{- " " | safe.HTMLAttr -}}
codecs="{{- . | transform.XMLEscape -}}"
{{- end -}}
>
{{- "\n" -}}
{{- with collections.Index . "sri_hash" -}}
{{- strings.Repeat (add $indent 1) " " -}}
<podcast:integrity type="sri" value="{{- . | transform.XMLEscape -}}" />
{{- "\n" -}}
{{- end -}}
{{- range collections.Index . "sources" -}}
{{- $url := partial "enclosure_url.rss.xml" (dict "context" . "episode_page" $episode_page "guid" $guid "use_op3" $use_op3) -}}
{{- strings.Repeat (add $indent 1) " " -}}
<podcast:source uri="{{- $url | transform.XMLEscape -}}"
{{- with collections.Index . "type" -}}
{{- " " | safe.HTMLAttr -}}
contentType="{{- . | transform.XMLEscape -}}"
{{- end -}}
{{- " " | safe.HTMLAttr -}}
/>
{{- end -}}
{{- "\n" -}}
{{- strings.Repeat $indent " " -}}
</podcast:alternateEnclosure>
{{- "\n" -}}
{{- end -}}
{{- end -}}
{{- with .Params.transcript -}}
{{- range . -}}
{{- $rel := collections.Index . "rel" -}}
{{- $lang := collections.Index . "language" -}}
{{- $formats := collections.Index . "formats" -}}
{{- with collections.Index $formats "srt" -}}
{{- partial "transcript.rss.xml" (dict "resource" . "type" "application/x-subrip" "lang" $lang "rel" $rel "episode_page" $episode_page "indent" $indent) -}}
{{- end -}}
{{- with collections.Index $formats "webvtt" -}}
{{- partial "transcript.rss.xml" (dict "resource" . "type" "text/webvtt" "lang" $lang "rel" $rel "episode_page" $episode_page "indent" $indent) -}}
{{- end -}}
{{- with collections.Index $formats "html" -}}
{{- partial "transcript.rss.xml" (dict "resource" . "type" "text/html" "lang" $lang "rel" $rel "episode_page" $episode_page "indent" $indent) -}}
{{- end -}}
{{- with collections.Index $formats "json" -}}
{{- partial "transcript.rss.xml" (dict "resource" . "type" "application/json" "lang" $lang "rel" $rel "episode_page" $episode_page "indent" $indent) -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- with .Params.funding -}}
{{- partial "funding.rss.xml" (dict "context" . "indent" $indent) -}}
{{- end -}}
{{- with .Params.persons -}}
{{- partial "persons.rss.xml" (dict "context" . "indent" $indent) -}}
{{- end -}}
{{- with .Params.social_interacts -}}
{{- partial "socialInteracts.rss.xml" (dict "context" . "indent" $indent) -}}
{{- end -}}
{{- with .Params.recommendations -}}
{{- partial "recommendations.rss.xml" (dict "context" . "indent" $indent) -}}
{{- end -}}
{{- partial "images.rss.xml" (dict "context" . "indent" $indent) -}}
{{- partial "licence.rss.xml" (dict "context" . "indent" $indent) -}}
{{- partial "location.rss.xml" (dict "context" . "indent" $indent) -}}
{{- with .Params.soundbites -}}
{{- range . -}}
{{- strings.Repeat $indent " " -}}
<podcast:soundbite startTime="{{- collections.Index . "start_time" | transform.XMLEscape -}}" duration="{{- collections.Index . "duration" -}}"
{{- with collections.Index . "title" -}}
>{{- . | transform.XMLEscape -}}</podcast:soundbite>
{{- else -}}
{{- " " | safe.HTMLAttr -}}
/>
{{- end -}}
{{- "\n" -}}
{{- end -}}
{{- end -}}
{{- with .Params.chapters -}}
{{- strings.Repeat $indent " " -}}
<podcast:chapters url="{{ ($episode_page.OutputFormats.Get "chapters").Permalink }}" type="application/json+chapters" />
{{- "\n" -}}
{{- strings.Repeat $indent " " -}}
<psc:chapters version="1.2" xmlns:psc="http://podlove.org/simple-chapters">
{{- "\n" -}}
{{- range . -}}
{{- partial "podlove_chapters.rss.xml" (dict "context" . "indent" (add $indent 1)) -}}
{{- end -}}
{{- strings.Repeat $indent " " -}}
</psc:chapters>
{{- "\n" -}}
{{- end -}}
{{- $indent = sub $indent 1 -}}
{{- strings.Repeat $indent " " -}}
</item> </item>
{{- "\n" -}} {{- "\n" -}}
{{- $indent = sub $indent 1 -}}
{{- end -}} {{- end -}}
</channel> </channel>
</rss> </rss>