[PR #3772] [MERGED] Feed episode IDs changing on refresh & several other refresh issues #4077

Closed
opened 2026-04-25 00:18:13 +02:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/advplyr/audiobookshelf/pull/3772
Author: @advplyr
Created: 1/1/2025
Status: Merged
Merged: 1/1/2025
Merged by: @advplyr

Base: masterHead: feed-episodes-upsert


📝 Commits (2)

  • 5201625 Fix FeedEpisodes using a new ID when updating #3757
  • e7f7d1a Fix refresh feed when book is deleted and belonged to a series/collection

📊 Changes

3 files changed (+80 additions, -30 deletions)

View changed files

📝 server/managers/RssFeedManager.js (+23 -8)
📝 server/models/Feed.js (+21 -9)
📝 server/models/FeedEpisode.js (+36 -13)

📄 Description

Brief summary

Feed episodes were dropping and re-creating the table record anytime a feed needed to be updated. Since the generated RSS feed uses the content url as the GUID this was changing on every update causing podcast clients to think it is a new episode.

Which issue is fixed?

https://github.com/advplyr/audiobookshelf/issues/3757

In-depth Description

To fix this the existing FeedEpisode records are loaded and the filePath is compared to see if a FeedEpisode should be updated. So if the filepath changes then the generated RSS feed guid will change.
Another option could be using the inode value but this would require storing the inode value in the FeedEpisode model and would cause issues for users using a file system that doesn't support unique inode values.

This fixes 3 other issues that I found while testing.

  1. For audiobook feeds. When book chapters are updated the Book.updatedAt timestamp changes but the LibraryItem.updatedAt timestamp does not. So changing book chapters wasn't causing a refresh of the feed. To fix this I add an additional check to see if the Book.updatedAt is more recent than the LibraryItem.updatedAt and use that as the Feed.entityUpdatedAt if so.
  2. For podcast feeds. The check was using the most recent PodcastEpisode.createdAt instead of PodcastEpisode.updatedAt. So updating a podcast episode wasn't refreshing the feed.
  3. For collection & series feeds. When removing a book from the library that belonged to the series or collection the feed would not refresh since it is checking the most recent updatedAt timestamp of the available books. To fix this I added a check to see if the total number of audio tracks has changed.

How have you tested this?

Opened a feed for a podcast, an audiobook, a collection and a series. Tested adding/removing/updating the entity and child entities.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/advplyr/audiobookshelf/pull/3772 **Author:** [@advplyr](https://github.com/advplyr) **Created:** 1/1/2025 **Status:** ✅ Merged **Merged:** 1/1/2025 **Merged by:** [@advplyr](https://github.com/advplyr) **Base:** `master` ← **Head:** `feed-episodes-upsert` --- ### 📝 Commits (2) - [`5201625`](https://github.com/advplyr/audiobookshelf/commit/5201625d38aa2dcda85fb3df3b270ae9adb3c021) Fix FeedEpisodes using a new ID when updating #3757 - [`e7f7d1a`](https://github.com/advplyr/audiobookshelf/commit/e7f7d1a573bd88e6d7d7fa5514a6178d91aaea92) Fix refresh feed when book is deleted and belonged to a series/collection ### 📊 Changes **3 files changed** (+80 additions, -30 deletions) <details> <summary>View changed files</summary> 📝 `server/managers/RssFeedManager.js` (+23 -8) 📝 `server/models/Feed.js` (+21 -9) 📝 `server/models/FeedEpisode.js` (+36 -13) </details> ### 📄 Description ## Brief summary Feed episodes were dropping and re-creating the table record anytime a feed needed to be updated. Since the generated RSS feed uses the content url as the GUID this was changing on every update causing podcast clients to think it is a new episode. ## Which issue is fixed? https://github.com/advplyr/audiobookshelf/issues/3757 ## In-depth Description To fix this the existing `FeedEpisode` records are loaded and the `filePath` is compared to see if a `FeedEpisode` should be updated. So if the filepath changes then the generated RSS feed guid will change. Another option could be using the inode value but this would require storing the inode value in the `FeedEpisode` model and would cause issues for users using a file system that doesn't support unique inode values. This fixes 3 other issues that I found while testing. 1. For audiobook feeds. When book chapters are updated the Book.updatedAt timestamp changes but the LibraryItem.updatedAt timestamp does not. So changing book chapters wasn't causing a refresh of the feed. To fix this I add an additional check to see if the Book.updatedAt is more recent than the LibraryItem.updatedAt and use that as the Feed.entityUpdatedAt if so. 2. For podcast feeds. The check was using the most recent PodcastEpisode.createdAt instead of PodcastEpisode.updatedAt. So updating a podcast episode wasn't refreshing the feed. 3. For collection & series feeds. When removing a book from the library that belonged to the series or collection the feed would not refresh since it is checking the most recent updatedAt timestamp of the available books. To fix this I added a check to see if the total number of audio tracks has changed. ## How have you tested this? Opened a feed for a podcast, an audiobook, a collection and a series. Tested adding/removing/updating the entity and child entities. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2026-04-25 00:18:13 +02:00
adam closed this issue 2026-04-25 00:18:13 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#4077