add srt files

This commit is contained in:
2024-12-24 15:20:16 -06:00
parent 3129677921
commit 566cdab6d6
95 changed files with 1199450 additions and 16 deletions

View File

@@ -31,6 +31,8 @@ async function podcastData (data) {
var file_stem
if (data.season === 1) {
file_stem = `ep${data.episode}`
} if (data.season === 2) {
file_stem = `${seasonEpisodeFormat(null, {...data, episodePrefix: "ep"}).toLowerCase()}`
} else {
file_stem = `${seasonEpisodeFormat(null, data).toLowerCase()}`
}
@@ -50,7 +52,18 @@ async function podcastData (data) {
}
}).catch((e)=>{return null})
const transcript_exists_promise = new Promise ((resolve, reject) => {
const transcript_page_exists_promises = [
`${data.page.filePathStem}`,
`../../../transcripts/${file_stem}`
].filter(file_path=>file_path).map((file_path)=>
fs.access(path.resolve(data.page.inputPath, `${file_path}.srt`))
.then(()=>path.resolve(data.page.filePathStem, file_path))
.catch((e)=>{
return null
})
)
transcript_file_exists_promise = new Promise ((resolve, reject) => {
if (data.podcast.transcriptUrl) {
resolve(data.podcast.transcriptUrl)
} else {
@@ -68,7 +81,8 @@ async function podcastData (data) {
const result = {
"enclosureUrl": await mp3_exists_promise,
"transcriptUrl": await transcript_exists_promise,
"transcriptUrl": await transcript_file_exists_promise,
"transcriptPage": (await Promise.all(transcript_page_exists_promises)).find(i=>i),
"title": data.podcast.title || `${seasonEpisodeFormat(null, data)}: ${data.title || "Episode " + data.episode}`,
"image" : data.podcast.image || data.image
}