mirror of
				https://github.com/advplyr/audiobookshelf.git
				synced 2025-10-27 11:18:14 +01:00 
			
		
		
		
	Adds check for duplicated chapter data
This commit is contained in:
		
							parent
							
								
									80ef8ee890
								
							
						
					
					
						commit
						36d2957fb4
					
				| @ -420,9 +420,18 @@ class Book { | ||||
|       } | ||||
|     } | ||||
| 
 | ||||
|     // IF first audio file has embedded chapters then use embedded chapters
 | ||||
|     // If first audio file has embedded chapters then use embedded chapters
 | ||||
|     if (includedAudioFiles[0].chapters?.length) { | ||||
|       Logger.debug(`[Book] setChapters: Using embedded chapters in audio file ${includedAudioFiles[0]?.metadata?.path}`) | ||||
|       // If all files chapters are the same, then only make chapters for the first file
 | ||||
|       if ( | ||||
|         includedAudioFiles.length > 1 && | ||||
|         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}`) | ||||
|         this.chapters = includedAudioFiles[0].chapters.map((c) => ({ ...c })) | ||||
|       } else { | ||||
|         Logger.debug(`[Book] setChapters: Using embedded chapters from all audio files ${includedAudioFiles[0].metadata?.path}`) | ||||
|         this.chapters = [] | ||||
|         let currChapterId = 0 | ||||
|         let currStartTime = 0 | ||||
| @ -441,6 +450,7 @@ class Book { | ||||
|             currStartTime += file.duration | ||||
|           } | ||||
|         }) | ||||
|       } | ||||
|     } else if (includedAudioFiles.length > 1) { | ||||
|       // Build chapters from audio files
 | ||||
|       this.chapters = [] | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user