From 5d96b2cc6e165dad812c1b0d4438afc387f1fc48 Mon Sep 17 00:00:00 2001 From: Joakim Ramer Date: Mon, 30 Jan 2023 12:56:22 +0100 Subject: [PATCH] Logs correctly and simplifies for single audio file. --- server/objects/mediaTypes/Book.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/objects/mediaTypes/Book.js b/server/objects/mediaTypes/Book.js index 011a13eb..9637eb50 100644 --- a/server/objects/mediaTypes/Book.js +++ b/server/objects/mediaTypes/Book.js @@ -424,8 +424,9 @@ class Book { if (includedAudioFiles[0].chapters?.length) { // If all files chapters are the same, then only make chapters for the first file if ( + includedAudioFiles.length === 1 || includedAudioFiles.length > 1 && - includedAudioFiles[0].chapters.length === includedAudioFiles[1].chapters.length && + includedAudioFiles[0].chapters.length === includedAudioFiles[1].chapters?.length && includedAudioFiles[0].chapters.every((c, i) => c.title === includedAudioFiles[1].chapters[i].title) ) { Logger.debug(`[Book] setChapters: Using embedded chapters in first audio file ${includedAudioFiles[0].metadata?.path}`)