Update podcast rss feed parser to use psc chapters on episodes

This commit is contained in:
advplyr 2025-03-31 17:57:39 -05:00
parent ddcda197b4
commit 6ed66fea16
5 changed files with 102 additions and 2 deletions

View file

@ -607,6 +607,7 @@ class Feed extends Model {
custom_namespaces: {
itunes: 'http://www.itunes.com/dtds/podcast-1.0.dtd',
podcast: 'https://podcastindex.org/namespace/1.0',
psc: 'http://podlove.org/simple-chapters',
googleplay: 'http://www.google.com/schemas/play-podcasts/1.0'
},
custom_elements: customElements

View file

@ -325,6 +325,24 @@ class FeedEpisode extends Model {
customElements.push({ 'itunes:summary': { _cdata: this.description } })
}
customElements.push({
'psc:chapters': [
{
_attr: {
version: '1.2'
},
'psc:chapter': [
{
_attr: {
title: 'Test',
start: '00:00:00'
}
}
]
}
]
})
return {
title: this.title,
description: this.description || '',

View file

@ -80,9 +80,13 @@ class PodcastEpisode extends Model {
if (rssPodcastEpisode.guid) {
podcastEpisode.extraData.guid = rssPodcastEpisode.guid
}
if (audioFile.chapters?.length) {
podcastEpisode.chapters = audioFile.chapters.map((ch) => ({ ...ch }))
} else if (rssPodcastEpisode.chapters?.length) {
podcastEpisode.chapters = rssPodcastEpisode.chapters.map((ch) => ({ ...ch }))
}
return this.create(podcastEpisode)
}