Logs correctly and simplifies for single audio file.

This commit is contained in:
Joakim Ramer 2023-01-30 12:56:22 +01:00
parent 72d0b097ab
commit 5d96b2cc6e
No known key found for this signature in database
GPG Key ID: 3DD9039EF02C0573

View File

@ -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}`)