add transcripts
This commit is contained in:
@@ -9,6 +9,7 @@ module.exports = {
|
||||
"podcast": (data) => {
|
||||
return {
|
||||
"enclosureUrl": data.podcast.enclosureUrl ||`${data.site.cdn}/${seasonEpisodeFormat(null, data).toLowerCase()}.mp3`,
|
||||
"transcriptUrl": data.podcast.transcriptUrl ||`${data.site.cdn}/${seasonEpisodeFormat(null, data).toLowerCase()}.srt`,
|
||||
"title": data.podcast.title || `${seasonEpisodeFormat(null, data)}: ${data.title || "Episode " + data.episode}`,
|
||||
"image" : data.podcast.image || data.image || "{{page.url}}/../image.jpg"
|
||||
}}
|
||||
|
||||
@@ -2,8 +2,6 @@ const { Podcast } = require('podcast');
|
||||
const music_metadata = require('music-metadata');
|
||||
const fs = require('fs');
|
||||
|
||||
const PODCAST_CDN_ROOT="https://podcast.rpg.cdn.ascorrea.com"
|
||||
|
||||
async function getMp3Duration(filePath) {
|
||||
try {
|
||||
const metadata = await music_metadata.parseFile(filePath);
|
||||
@@ -49,19 +47,25 @@ class PodcastFeed {
|
||||
});
|
||||
|
||||
const items = data.collections[data.episodeCollection]?.filter(episode=>episode.data.podcast!=false)
|
||||
|
||||
var item
|
||||
items.forEach(episode=>{
|
||||
// const duration = getMp3Duration(`../episodes/s${zero_pad_season}/s${zero_pad_season}e${episode.data.episode}.mp3`)
|
||||
/* loop over data and add to feed */
|
||||
feed.addItem({
|
||||
item = {
|
||||
title: `${episode.data.podcast.title}`,
|
||||
description: episode.content,
|
||||
url: data.site.url+this.url(episode.url), // link to the item
|
||||
guid: episode.url, // optional - defaults to url
|
||||
date: episode.data.date, // any format that js Date can parse.
|
||||
enclosure : {url:`${episode.data.podcast.enclosureUrl}`}, // optional enclosure
|
||||
customElements: []
|
||||
// itunesDuration: duration,
|
||||
});
|
||||
}
|
||||
if (episode.data.podcast.transcriptUrl) {
|
||||
item.customElements.push({ 'podcast:transcript': `${episode.data.podcast.transcriptUrl}` })
|
||||
}
|
||||
item = feed.addItem(item);
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user