From 21e1f62c65c041934b495ee281699c297fdb782c Mon Sep 17 00:00:00 2001 From: advplyr Date: Fri, 29 Jul 2022 18:15:41 -0500 Subject: [PATCH] Fix:Merging chapters from multiple files skipping chapters #857 --- server/objects/mediaTypes/Book.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/objects/mediaTypes/Book.js b/server/objects/mediaTypes/Book.js index ec4e88fc..6732b308 100644 --- a/server/objects/mediaTypes/Book.js +++ b/server/objects/mediaTypes/Book.js @@ -420,10 +420,10 @@ class Book { // If audio file has chapters use chapters if (file.chapters && file.chapters.length) { file.chapters.forEach((chapter) => { - if (chapter.start > this.duration) { + if (currStartTime > this.duration) { Logger.warn(`[Book] Invalid chapter start time > duration`) } else { - var chapterAlreadyExists = this.chapters.find(ch => ch.start === chapter.start) + var chapterAlreadyExists = this.chapters.find(ch => ch.start === currStartTime) if (!chapterAlreadyExists) { var chapterDuration = chapter.end - chapter.start if (chapterDuration > 0) {