mirror of
				https://github.com/advplyr/audiobookshelf.git
				synced 2025-10-27 11:18:14 +01:00 
			
		
		
		
	Fix:Series & collection rss feeds repeating first book #1531
This commit is contained in:
		
							parent
							
								
									785942b94f
								
							
						
					
					
						commit
						557d3243c3
					
				| @ -77,6 +77,7 @@ class Feed { | |||||||
| 
 | 
 | ||||||
|   getEpisodePath(id) { |   getEpisodePath(id) { | ||||||
|     var episode = this.episodes.find(ep => ep.id === id) |     var episode = this.episodes.find(ep => ep.id === id) | ||||||
|  |     console.log('getEpisodePath=', id, episode) | ||||||
|     if (!episode) return null |     if (!episode) return null | ||||||
|     return episode.fullPath |     return episode.fullPath | ||||||
|   } |   } | ||||||
|  | |||||||
| @ -95,19 +95,22 @@ class FeedEpisode { | |||||||
|     this.fullPath = episode.audioFile.metadata.path |     this.fullPath = episode.audioFile.metadata.path | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   setFromAudiobookTrack(libraryItem, serverAddress, slug, audioTrack, meta, additionalOffset = 0) { |   setFromAudiobookTrack(libraryItem, serverAddress, slug, audioTrack, meta, additionalOffset = null) { | ||||||
|     // Example: <pubDate>Fri, 04 Feb 2015 00:00:00 GMT</pubDate>
 |     // Example: <pubDate>Fri, 04 Feb 2015 00:00:00 GMT</pubDate>
 | ||||||
|     let timeOffset = isNaN(audioTrack.index) ? 0 : (Number(audioTrack.index) * 1000) // Offset pubdate to ensure correct order
 |     let timeOffset = isNaN(audioTrack.index) ? 0 : (Number(audioTrack.index) * 1000) // Offset pubdate to ensure correct order
 | ||||||
|  |     let episodeId = String(audioTrack.index) | ||||||
| 
 | 
 | ||||||
|     // Additional offset can be used for collections/series
 |     // Additional offset can be used for collections/series
 | ||||||
|     if (additionalOffset && !isNaN(additionalOffset)) { |     if (additionalOffset !== null && !isNaN(additionalOffset)) { | ||||||
|       timeOffset += Number(additionalOffset) * 1000 |       timeOffset += Number(additionalOffset) * 1000 | ||||||
|  | 
 | ||||||
|  |       episodeId = String(additionalOffset) + '-' + episodeId | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     // e.g. Track 1 will have a pub date before Track 2
 |     // e.g. Track 1 will have a pub date before Track 2
 | ||||||
|     const audiobookPubDate = date.format(new Date(libraryItem.addedAt + timeOffset), 'ddd, DD MMM YYYY HH:mm:ss [GMT]') |     const audiobookPubDate = date.format(new Date(libraryItem.addedAt + timeOffset), 'ddd, DD MMM YYYY HH:mm:ss [GMT]') | ||||||
| 
 | 
 | ||||||
|     const contentUrl = `/feed/${slug}/item/${audioTrack.index}/${audioTrack.metadata.filename}` |     const contentUrl = `/feed/${slug}/item/${episodeId}/${audioTrack.metadata.filename}` | ||||||
|     const media = libraryItem.media |     const media = libraryItem.media | ||||||
|     const mediaMetadata = media.metadata |     const mediaMetadata = media.metadata | ||||||
| 
 | 
 | ||||||
| @ -122,7 +125,7 @@ class FeedEpisode { | |||||||
|       } |       } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     this.id = String(audioTrack.index) |     this.id = episodeId | ||||||
|     this.title = title |     this.title = title | ||||||
|     this.description = mediaMetadata.description || '' |     this.description = mediaMetadata.description || '' | ||||||
|     this.enclosure = { |     this.enclosure = { | ||||||
| @ -157,9 +160,9 @@ class FeedEpisode { | |||||||
|         { |         { | ||||||
|           "itunes:explicit": !!this.explicit |           "itunes:explicit": !!this.explicit | ||||||
|         }, |         }, | ||||||
|         {"itunes:episodeType": this.episodeType}, |         { "itunes:episodeType": this.episodeType }, | ||||||
|         {"itunes:season": this.season}, |         { "itunes:season": this.season }, | ||||||
|         {"itunes:episode": this.episode} |         { "itunes:episode": this.episode } | ||||||
|       ] |       ] | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user