RSS feed for collection to update when any item in the collection is updated #606

This commit is contained in:
advplyr 2022-12-28 18:08:03 -06:00
parent 9e4bc582cb
commit 315c83e4c3
4 changed files with 24 additions and 10 deletions

View file

@ -167,7 +167,7 @@ class Feed {
this.userId = userId
this.entityType = 'collection'
this.entityId = collectionExpanded.id
this.entityUpdatedAt = collectionExpanded.lastUpdate
this.entityUpdatedAt = collectionExpanded.lastUpdate // This will be set to the most recently updated library item
this.coverPath = firstItemWithCover?.coverPath || null
this.serverAddress = serverAddress
this.feedUrl = feedUrl
@ -184,6 +184,8 @@ class Feed {
this.episodes = []
itemsWithTracks.forEach((item, index) => {
if (item.updatedAt > this.entityUpdatedAt) this.entityUpdatedAt = item.updatedAt
item.media.tracks.forEach((audioTrack) => {
const feedEpisode = new FeedEpisode()
feedEpisode.setFromAudiobookTrack(item, serverAddress, slug, audioTrack, this.meta, index)
@ -211,6 +213,8 @@ class Feed {
this.episodes = []
itemsWithTracks.forEach((item, index) => {
if (item.updatedAt > this.entityUpdatedAt) this.entityUpdatedAt = item.updatedAt
item.media.tracks.forEach((audioTrack) => {
const feedEpisode = new FeedEpisode()
feedEpisode.setFromAudiobookTrack(item, this.serverAddress, this.slug, audioTrack, this.meta, index)