mirror of
				https://github.com/advplyr/audiobookshelf.git
				synced 2025-10-27 11:18:14 +01:00 
			
		
		
		
	Merge pull request #1212 from Weldawadyathink/master
Improve title naming for single file audiobooks when opening RSS feed
This commit is contained in:
		
						commit
						a0a6256c7a
					
				@ -92,12 +92,16 @@ class FeedEpisode {
 | 
				
			|||||||
    const media = libraryItem.media
 | 
					    const media = libraryItem.media
 | 
				
			||||||
    const mediaMetadata = media.metadata
 | 
					    const mediaMetadata = media.metadata
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    var title = audioTrack.title
 | 
					    let title = audioTrack.title
 | 
				
			||||||
 | 
					    if (libraryItem.media.tracks.length == 1) { // If audiobook is a single file, use book title instead of chapter/file title
 | 
				
			||||||
 | 
					      title = libraryItem.media.metadata.title
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
      if (libraryItem.media.chapters.length) {
 | 
					      if (libraryItem.media.chapters.length) {
 | 
				
			||||||
        // If audio track start and chapter start are within 1 seconds of eachother then use the chapter title
 | 
					        // If audio track start and chapter start are within 1 seconds of eachother then use the chapter title
 | 
				
			||||||
        var matchingChapter = libraryItem.media.chapters.find(ch => Math.abs(ch.start - audioTrack.startOffset) < 1)
 | 
					        var matchingChapter = libraryItem.media.chapters.find(ch => Math.abs(ch.start - audioTrack.startOffset) < 1)
 | 
				
			||||||
        if (matchingChapter && matchingChapter.title) title = matchingChapter.title
 | 
					        if (matchingChapter && matchingChapter.title) title = matchingChapter.title
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.id = String(audioTrack.index)
 | 
					    this.id = String(audioTrack.index)
 | 
				
			||||||
    this.title = title
 | 
					    this.title = title
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user