feat: generate podlove episode configuration

This commit is contained in:
Florian Maury 2024-10-27 23:11:53 +01:00
parent 231a5b6d87
commit 5524256bd3
2 changed files with 37 additions and 0 deletions

View file

@ -11,6 +11,7 @@ outputs:
- transcripthtml - transcripthtml
- transcriptjson - transcriptjson
- transcriptpodlove - transcriptpodlove
- podlove-episode
type: episode type: episode
params: params:
enclosure: enclosure:

View file

@ -0,0 +1,36 @@
{{- $page := . -}}
{{- $podcasts := collections.Where .Ancestors "Type" "podcast" -}}
{{- $podcast := collections.Index $podcasts 0 }}
{{- $showTitle := $podcast.Title -}}
{{- $showSummary := $podcast.Description -}}
{{- $showLink := $podcast.Permalink -}}
{{- $showLogo := partial "external_or_local.rss.xml" (dict "context" $podcast.Params.image "ref_page" $podcast) -}}
{{- $show := dict "title" $showTitle "summary" $showSummary "poster" $showLogo "link" $showLink -}}
{{- $episodeDuration := "" -}}
{{- with .Params.duration -}}
{{- $episodeDuration = partial "ms_to_timecode.tmpl" (dict "start_time" . "long_format" true) -}}
{{- end -}}
{{- $episodeImage := "" -}}
{{- with .Params.image -}}
{{- $episodeImage := partial "external_or_local.rss.xml" (dict "context" . "ref_page" $page) -}}
{{- end -}}
{{- $chaptersFile := .OutputFormats.Get "chapterspodlove" -}}
{{- $transcriptFile := .OutputFormats.Get "transcriptpodlove" -}}
{{- $audioFiles := slice -}}
{{- range .Params.alternate_enclosures -}}
{{- if reflect.IsMap . -}}
{{- $size := .length -}}
{{- range .sources -}}
{{- $url := partial "external_or_local.rss.xml" (dict "context" . "ref_page" $page) -}}
{{- $audioFile := dict "url" $url "size" $size "title" $.Title "mimeType" .type -}}
{{- $audioFiles = collections.Append $audioFile $audioFiles -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- $document := dict "version" 5 "show" $show "title" .Title "summary" .Description "publicationDate" .Date "duration" $episodeDuration "poster" $episodeImage "link" .Permalink "chapters" $chaptersFile.Permalink "transcripts" $transcriptFile.Permalink "audio" $audioFiles -}}
{{- encoding.Jsonify $document | safe.JS -}}