Fix:Merging chapters from multiple files skipping chapters #857

This commit is contained in:
advplyr 2022-07-29 18:15:41 -05:00
parent 8416f2d6be
commit 21e1f62c65

View File

@ -420,10 +420,10 @@ class Book {
// If audio file has chapters use chapters // If audio file has chapters use chapters
if (file.chapters && file.chapters.length) { if (file.chapters && file.chapters.length) {
file.chapters.forEach((chapter) => { file.chapters.forEach((chapter) => {
if (chapter.start > this.duration) { if (currStartTime > this.duration) {
Logger.warn(`[Book] Invalid chapter start time > duration`) Logger.warn(`[Book] Invalid chapter start time > duration`)
} else { } else {
var chapterAlreadyExists = this.chapters.find(ch => ch.start === chapter.start) var chapterAlreadyExists = this.chapters.find(ch => ch.start === currStartTime)
if (!chapterAlreadyExists) { if (!chapterAlreadyExists) {
var chapterDuration = chapter.end - chapter.start var chapterDuration = chapter.end - chapter.start
if (chapterDuration > 0) { if (chapterDuration > 0) {