Update updating of end values to use new chaptersToPush temp array

This commit is contained in:
Harry Rose 2026-03-10 20:59:25 +00:00
parent e096a04603
commit 256c341f06

View file

@ -141,8 +141,8 @@ class PodcastEpisode extends Model {
let chapter = { title: chapterTitleMatch[1].trim(), id: i, start: startTime } let chapter = { title: chapterTitleMatch[1].trim(), id: i, start: startTime }
if (podcastEpisode.chapters.length > 0) { if (chaptersToPush.length > 0) {
podcastEpisode.chapters[podcastEpisode.chapters.length - 1].end = startTime chaptersToPush[chaptersToPush.length - 1].end = startTime
} }
chaptersToPush.push(chapter) chaptersToPush.push(chapter)
@ -150,8 +150,8 @@ class PodcastEpisode extends Model {
Logger.debug('Added chapter', chapter) Logger.debug('Added chapter', chapter)
} }
if (errorMessage == null) { if (errorMessage == null) {
if (podcastEpisode.chapters.length > 0) { if (chaptersToPush.length > 0) {
podcastEpisode.chapters[podcastEpisode.chapters.length - 1].end = podcastEpisode.audioFile.duration chaptersToPush[chaptersToPush.length - 1].end = podcastEpisode.audioFile.duration
} }
podcastEpisode.chapters.push(...chaptersToPush) podcastEpisode.chapters.push(...chaptersToPush)