[PR #3787] [MERGED] Fix remove episode from playlist #4084

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

📋 Pull Request Information

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

Base: masterHead: fix-remove-episode-from-playlist


📝 Commits (2)

  • 63466ec Fix deleting episode library file removes episode from playlist #3784
  • 6467a92 Remove media progress when deleting podcast episode audio file

📊 Changes

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

View changed files

📝 server/Database.js (+21 -0)
📝 server/controllers/LibraryItemController.js (+14 -0)
📝 server/models/Playlist.js (+44 -0)
📝 server/routers/ApiRouter.js (+1 -30)

📄 Description

Brief summary

Deleting an audio file for a podcast episode from the library files table will remove the associated podcast episode.
When removing an episode in that way the playlist media item was not getting removed.
This caused a crash when querying for that playlist.

Which issue is fixed?

Fixes https://github.com/advplyr/audiobookshelf/issues/3784

In-depth Description

To solve the crash the cleanDatabase startup function will remove any playlistMediaItem records with no associated media item.
In fixing the underlying issue I also added a missing check to remove mediaProgress records for that episode.

How have you tested this?

Tested with both podcast and book playlists deleting the episode/book both from the UI and manually from the database.


🔄 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/3787 **Author:** [@advplyr](https://github.com/advplyr) **Created:** 1/3/2025 **Status:** ✅ Merged **Merged:** 1/3/2025 **Merged by:** [@advplyr](https://github.com/advplyr) **Base:** `master` ← **Head:** `fix-remove-episode-from-playlist` --- ### 📝 Commits (2) - [`63466ec`](https://github.com/advplyr/audiobookshelf/commit/63466ec48bee46a9b4a0d4e95b1652ec79220e23) Fix deleting episode library file removes episode from playlist #3784 - [`6467a92`](https://github.com/advplyr/audiobookshelf/commit/6467a92de6db0c9fe4eb5a492fe5272de68922e7) Remove media progress when deleting podcast episode audio file ### 📊 Changes **4 files changed** (+80 additions, -30 deletions) <details> <summary>View changed files</summary> 📝 `server/Database.js` (+21 -0) 📝 `server/controllers/LibraryItemController.js` (+14 -0) 📝 `server/models/Playlist.js` (+44 -0) 📝 `server/routers/ApiRouter.js` (+1 -30) </details> ### 📄 Description ## Brief summary Deleting an audio file for a podcast episode from the library files table will remove the associated podcast episode. When removing an episode in that way the playlist media item was not getting removed. This caused a crash when querying for that playlist. ## Which issue is fixed? Fixes https://github.com/advplyr/audiobookshelf/issues/3784 ## In-depth Description To solve the crash the `cleanDatabase` startup function will remove any `playlistMediaItem` records with no associated media item. In fixing the underlying issue I also added a missing check to remove `mediaProgress` records for that episode. ## How have you tested this? Tested with both podcast and book playlists deleting the episode/book both from the UI and manually from the database. --- <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:15 +02:00
adam closed this issue 2026-04-25 00:18:15 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#4084