Deleting a series leaves its files and media_files rows behind #128

Closed
opened 2026-08-23 15:55:56 +01:00 by naps62-yolo · 0 comments
Owner

DELETE /api/series/{id} runs one statement, DELETE FROM series WHERE id = ?.
DELETE /api/movies/{id} does considerably more, and for reasons documented in
crates/arr-api/src/movies.rs:366: it unlinks what the title wrote, clears
media_files, and clears title_owners.

Two consequences on the TV side:

  • Every episode file the series imported stays on disk, so deleting a series in
    the UI appears to do nothing to Jellyfin.
  • media_files rows with owner_kind = 'episode' are orphaned. media_files.path
    is unique and the owner is polymorphic, so nothing cascades from the seasons
    and episodes rows — re-adding the series then fails to import the same paths.

Mirror the movie handler: load first so a missing series is a 404 before
anything touches disk, unlink only paths recorded in media_files (§2 — the
service knows only what it wrote, never a scan, never a re-derived §7.4 name),
then clear media_files, title_owners and the series row.

Torrents are untouched, per §7.3.

`DELETE /api/series/{id}` runs one statement, `DELETE FROM series WHERE id = ?`. `DELETE /api/movies/{id}` does considerably more, and for reasons documented in `crates/arr-api/src/movies.rs:366`: it unlinks what the title wrote, clears `media_files`, and clears `title_owners`. Two consequences on the TV side: - Every episode file the series imported stays on disk, so deleting a series in the UI appears to do nothing to Jellyfin. - `media_files` rows with `owner_kind = 'episode'` are orphaned. `media_files.path` is unique and the owner is polymorphic, so nothing cascades from the seasons and episodes rows — re-adding the series then fails to import the same paths. Mirror the movie handler: load first so a missing series is a 404 before anything touches disk, unlink only paths recorded in `media_files` (§2 — the service knows only what it wrote, never a scan, never a re-derived §7.4 name), then clear `media_files`, `title_owners` and the series row. Torrents are untouched, per §7.3.
naps62-yolo added the area/apidifficulty/easyphase/6-tvtype/bug labels 2026-08-23 15:55:56 +01:00
naps62-yolo added this to the TV tracking milestone 2026-08-23 15:58:35 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: yolo/arr#128