mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-01-03 00:06:46 +01:00
Fix:Podcast RSS feeds update on new/updated episodes #1435
This commit is contained in:
parent
f83dd29213
commit
8908aa7a82
@ -81,9 +81,17 @@ class RssFeedManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if feed needs to be updated
|
// Check if feed needs to be updated
|
||||||
if (feed.entityType === 'item') {
|
if (feed.entityType === 'libraryItem') {
|
||||||
const libraryItem = this.db.getLibraryItem(feed.entityId)
|
const libraryItem = this.db.getLibraryItem(feed.entityId)
|
||||||
if (libraryItem && (!feed.entityUpdatedAt || libraryItem.updatedAt > feed.entityUpdatedAt)) {
|
|
||||||
|
let mostRecentlyUpdatedAt = libraryItem.updatedAt
|
||||||
|
if (libraryItem.isPodcast) {
|
||||||
|
libraryItem.media.episodes.forEach((episode) => {
|
||||||
|
if (episode.updatedAt > mostRecentlyUpdatedAt) mostRecentlyUpdatedAt = episode.updatedAt
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if (libraryItem && (!feed.entityUpdatedAt || mostRecentlyUpdatedAt > feed.entityUpdatedAt)) {
|
||||||
Logger.debug(`[RssFeedManager] Updating RSS feed for item ${libraryItem.id} "${libraryItem.media.metadata.title}"`)
|
Logger.debug(`[RssFeedManager] Updating RSS feed for item ${libraryItem.id} "${libraryItem.media.metadata.title}"`)
|
||||||
feed.updateFromItem(libraryItem)
|
feed.updateFromItem(libraryItem)
|
||||||
await this.db.updateEntity('feed', feed)
|
await this.db.updateEntity('feed', feed)
|
||||||
|
@ -110,13 +110,15 @@ class Feed {
|
|||||||
this.episodes = []
|
this.episodes = []
|
||||||
if (isPodcast) { // PODCAST EPISODES
|
if (isPodcast) { // PODCAST EPISODES
|
||||||
media.episodes.forEach((episode) => {
|
media.episodes.forEach((episode) => {
|
||||||
var feedEpisode = new FeedEpisode()
|
if (episode.updatedAt > this.entityUpdatedAt) this.entityUpdatedAt = episode.updatedAt
|
||||||
|
|
||||||
|
const feedEpisode = new FeedEpisode()
|
||||||
feedEpisode.setFromPodcastEpisode(libraryItem, serverAddress, slug, episode, this.meta)
|
feedEpisode.setFromPodcastEpisode(libraryItem, serverAddress, slug, episode, this.meta)
|
||||||
this.episodes.push(feedEpisode)
|
this.episodes.push(feedEpisode)
|
||||||
})
|
})
|
||||||
} else { // AUDIOBOOK EPISODES
|
} else { // AUDIOBOOK EPISODES
|
||||||
media.tracks.forEach((audioTrack) => {
|
media.tracks.forEach((audioTrack) => {
|
||||||
var feedEpisode = new FeedEpisode()
|
const feedEpisode = new FeedEpisode()
|
||||||
feedEpisode.setFromAudiobookTrack(libraryItem, serverAddress, slug, audioTrack, this.meta)
|
feedEpisode.setFromAudiobookTrack(libraryItem, serverAddress, slug, audioTrack, this.meta)
|
||||||
this.episodes.push(feedEpisode)
|
this.episodes.push(feedEpisode)
|
||||||
})
|
})
|
||||||
@ -144,13 +146,15 @@ class Feed {
|
|||||||
this.episodes = []
|
this.episodes = []
|
||||||
if (isPodcast) { // PODCAST EPISODES
|
if (isPodcast) { // PODCAST EPISODES
|
||||||
media.episodes.forEach((episode) => {
|
media.episodes.forEach((episode) => {
|
||||||
var feedEpisode = new FeedEpisode()
|
if (episode.updatedAt > this.entityUpdatedAt) this.entityUpdatedAt = episode.updatedAt
|
||||||
|
|
||||||
|
const feedEpisode = new FeedEpisode()
|
||||||
feedEpisode.setFromPodcastEpisode(libraryItem, this.serverAddress, this.slug, episode, this.meta)
|
feedEpisode.setFromPodcastEpisode(libraryItem, this.serverAddress, this.slug, episode, this.meta)
|
||||||
this.episodes.push(feedEpisode)
|
this.episodes.push(feedEpisode)
|
||||||
})
|
})
|
||||||
} else { // AUDIOBOOK EPISODES
|
} else { // AUDIOBOOK EPISODES
|
||||||
media.tracks.forEach((audioTrack) => {
|
media.tracks.forEach((audioTrack) => {
|
||||||
var feedEpisode = new FeedEpisode()
|
const feedEpisode = new FeedEpisode()
|
||||||
feedEpisode.setFromAudiobookTrack(libraryItem, this.serverAddress, this.slug, audioTrack, this.meta)
|
feedEpisode.setFromAudiobookTrack(libraryItem, this.serverAddress, this.slug, audioTrack, this.meta)
|
||||||
this.episodes.push(feedEpisode)
|
this.episodes.push(feedEpisode)
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user