mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-07-02 05:24:58 +02:00
Fix merging embedded chapters for multi-track audiobooks giving incorrect chapter ids #3361
- Also trim chapter titles on probe (remove carriage return)
This commit is contained in:
parent
0da9a04d8e
commit
64e9ac9d8f
2 changed files with 6 additions and 4 deletions
|
@ -499,16 +499,17 @@ class AudioFileScanner {
|
|||
// Filter these out and log a warning
|
||||
// See https://github.com/advplyr/audiobookshelf/issues/3361
|
||||
const afChaptersCleaned =
|
||||
file.chapters?.filter((c) => {
|
||||
file.chapters?.filter((c, i) => {
|
||||
if (c.end - c.start < 0.1) {
|
||||
libraryScan.addLog(LogLevel.WARN, `Chapter "${c.title}" has invalid duration of ${c.end - c.start} seconds. Skipping this chapter.`)
|
||||
libraryScan.addLog(LogLevel.WARN, `Audio file "${file.metadata.filename}" Chapter "${c.title}" (index ${i}) has invalid duration of ${c.end - c.start} seconds. Skipping this chapter.`)
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}) || []
|
||||
const afChapters = afChaptersCleaned.map((c) => ({
|
||||
|
||||
const afChapters = afChaptersCleaned.map((c, i) => ({
|
||||
...c,
|
||||
id: c.id + currChapterId,
|
||||
id: currChapterId + i,
|
||||
start: c.start + currStartTime,
|
||||
end: c.end + currStartTime
|
||||
}))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue