Remove xml cache from Feed object

This commit is contained in:
mikiher 2024-12-08 09:48:58 +02:00
parent a8ab8badd5
commit b38ce41731

View File

@ -29,9 +29,6 @@ class Feed {
this.createdAt = null this.createdAt = null
this.updatedAt = null this.updatedAt = null
// Cached xml
this.xml = null
if (feed) { if (feed) {
this.construct(feed) this.construct(feed)
} }
@ -202,7 +199,6 @@ class Feed {
} }
this.updatedAt = Date.now() this.updatedAt = Date.now()
this.xml = null
} }
setFromCollection(userId, slug, collectionExpanded, serverAddress, preventIndexing = true, ownerName = null, ownerEmail = null) { setFromCollection(userId, slug, collectionExpanded, serverAddress, preventIndexing = true, ownerName = null, ownerEmail = null) {
@ -297,7 +293,6 @@ class Feed {
}) })
this.updatedAt = Date.now() this.updatedAt = Date.now()
this.xml = null
} }
setFromSeries(userId, slug, seriesExpanded, serverAddress, preventIndexing = true, ownerName = null, ownerEmail = null) { setFromSeries(userId, slug, seriesExpanded, serverAddress, preventIndexing = true, ownerName = null, ownerEmail = null) {
@ -399,18 +394,14 @@ class Feed {
}) })
this.updatedAt = Date.now() this.updatedAt = Date.now()
this.xml = null
} }
buildXml(originalHostPrefix) { buildXml(originalHostPrefix) {
if (this.xml) return this.xml
var rssfeed = new RSS(this.meta.getRSSData(originalHostPrefix)) var rssfeed = new RSS(this.meta.getRSSData(originalHostPrefix))
this.episodes.forEach((ep) => { this.episodes.forEach((ep) => {
rssfeed.item(ep.getRSSData(originalHostPrefix)) rssfeed.item(ep.getRSSData(originalHostPrefix))
}) })
this.xml = rssfeed.xml() return rssfeed.xml()
return this.xml
} }
getAuthorsStringFromLibraryItems(libraryItems) { getAuthorsStringFromLibraryItems(libraryItems) {