API gap: media browse (all kinds), search, detail, delete, image folders (#141 blocker) #161

Closed
opened 2026-07-07 13:24:00 +02:00 by timothy · 2 comments
Owner

Recon for #141 (2026-07-07) — blocks #91 phase (b), part of epic #59. Pattern follows #151–#153/#155; coordinate paged-DTO shape with #155.

Blazor's media pages are all Lucene-search-backed (QuerySearchIndex* per kind; list pages = type:{kind} AND (query); trash = state:FileNotFound). Existing API: GET /api/library/browse covers only Movie/Show/Season/Artist (+collection kinds) — GetLibraryBrowseItemsHandler.MediaTypesFor returns [] for the other six media kinds. POST /api/maintenance/empty_trash exists.

Gaps (handlers all exist, unexposed):

  1. Extend browse to all kinds (highest leverage, smallest change): add Episode/MusicVideo/Song/OtherVideo/Image/RemoteStream to LibraryBrowseMediaType + MediaTypesFor + hydrators (mirror GetMovies). One change backfills all flat list pages, trash grids, and per-kind search.
  2. GET /api/search?query= → multi-kind grouped results (wrap the per-kind QuerySearchIndex* fan-out and/or QuerySearchIndexAllItems for bulk-id retrieval); powers /search and (with state:FileNotFound) the trash screen.
  3. Detail endpoints: GET /api/movies/{id}, /api/shows/{id} (+season cards), /api/seasons/{id} (+episode cards), /api/artists/{id} (+music-video cards) wrapping Get{Kind}ById; GET /api/media-items/{id}/info wrapping GetMediaItemInfo.
  4. DELETE /api/media-items (body { ids: [] }) → DeleteItemsFromDatabase (per-item/selection delete in trash; the only delete surface in Blazor).
  5. GET /api/images/folders?parentId= → GetImageFolders (image browser tree; + UpdateImageFolderDuration).

Add-to-collection reuses POST /api/collections/{id}/items (#155 fixes the 500). Add-to-playlist = #153 scope. Save-as-smart-collection exists. New DTOs in ErsatzTV.Core/Api with file-scoped #nullable enable (the MediaCards VMs are clean paged shapes but live in Application and lack nullable context — mirror, don't expose).

Recon for #141 (2026-07-07) — blocks #91 phase (b), part of epic #59. Pattern follows #151–#153/#155; coordinate paged-DTO shape with #155. Blazor's media pages are all Lucene-search-backed (`QuerySearchIndex*` per kind; list pages = `type:{kind} AND (query)`; trash = `state:FileNotFound`). Existing API: `GET /api/library/browse` covers only Movie/Show/Season/Artist (+collection kinds) — `GetLibraryBrowseItemsHandler.MediaTypesFor` returns `[]` for the other six media kinds. `POST /api/maintenance/empty_trash` exists. Gaps (handlers all exist, unexposed): 1. **Extend browse to all kinds** (highest leverage, smallest change): add `Episode/MusicVideo/Song/OtherVideo/Image/RemoteStream` to `LibraryBrowseMediaType` + `MediaTypesFor` + hydrators (mirror `GetMovies`). One change backfills all flat list pages, trash grids, and per-kind search. 2. **`GET /api/search?query=`** → multi-kind grouped results (wrap the per-kind `QuerySearchIndex*` fan-out and/or `QuerySearchIndexAllItems` for bulk-id retrieval); powers `/search` and (with `state:FileNotFound`) the trash screen. 3. **Detail endpoints**: `GET /api/movies/{id}`, `/api/shows/{id}` (+season cards), `/api/seasons/{id}` (+episode cards), `/api/artists/{id}` (+music-video cards) wrapping `Get{Kind}ById`; `GET /api/media-items/{id}/info` wrapping `GetMediaItemInfo`. 4. **`DELETE /api/media-items`** (body `{ ids: [] }`) → `DeleteItemsFromDatabase` (per-item/selection delete in trash; the only delete surface in Blazor). 5. **`GET /api/images/folders?parentId=`** → `GetImageFolders` (image browser tree; + `UpdateImageFolderDuration`). Add-to-collection reuses `POST /api/collections/{id}/items` (#155 fixes the 500). Add-to-playlist = #153 scope. Save-as-smart-collection exists. New DTOs in ErsatzTV.Core/Api with file-scoped `#nullable enable` (the MediaCards VMs are clean paged shapes but live in Application and lack nullable context — mirror, don't expose).
Author
Owner

Core implemented in PR #168 (items 1, 2, 4 of the gap list: browse-all-kinds, GET /api/search incl. state:FileNotFound passthrough, DELETE /api/media-items). Remaining in scope here: item 3 (detail endpoints + GetMediaItemInfo) and item 5 (image folders) — needed for #141's leftover detail pages/image browser. Leaving open.

Core implemented in PR #168 (items 1, 2, 4 of the gap list: browse-all-kinds, `GET /api/search` incl. `state:FileNotFound` passthrough, `DELETE /api/media-items`). Remaining in scope here: item 3 (detail endpoints + `GetMediaItemInfo`) and item 5 (image folders) — needed for #141's leftover detail pages/image browser. Leaving open.
Author
Owner

Closing — all five items are on main.

  • Items 1 (browse all kinds), 2 (GET /api/search), 4 (DELETE /api/media-items): landed in earlier parity PRs.
  • Item 3 (detail endpoints): PR #183 (merged, dbda2d89) — GET /api/{movies,shows,seasons,artists}/{id} + GET /api/media-items/{id}/info (404/422 mapping); child listings via browse parentId extended to Episode and MusicVideo.
  • Item 5 (image folders): PR #183 — GET /api/images/folders?parentId= + PUT /api/images/folders/{id}/duration (400 non-positive / null clears / 404 unknown folder via new ImageFolderExists guard; shared handler untouched for Blazor).

Artwork in all new DTOs uses the rooted-URL contract via the shared ApiArtwork.Root() helper (PR #181 convention). Verification: adversarial review clean (no must/should-fixes), live E2E passed (deep-link 404 states, back/forward sub-path nav, 11 contract checks), CI green. Tests: ErsatzTV.Tests 828, web 330.

**Closing** — all five items are on main. - Items 1 (browse all kinds), 2 (GET /api/search), 4 (DELETE /api/media-items): landed in earlier parity PRs. - Item 3 (detail endpoints): PR #183 (merged, dbda2d89) — `GET /api/{movies,shows,seasons,artists}/{id}` + `GET /api/media-items/{id}/info` (404/422 mapping); child listings via browse `parentId` extended to Episode and MusicVideo. - Item 5 (image folders): PR #183 — `GET /api/images/folders?parentId=` + `PUT /api/images/folders/{id}/duration` (400 non-positive / null clears / 404 unknown folder via new `ImageFolderExists` guard; shared handler untouched for Blazor). Artwork in all new DTOs uses the rooted-URL contract via the shared `ApiArtwork.Root()` helper (PR #181 convention). Verification: adversarial review clean (no must/should-fixes), live E2E passed (deep-link 404 states, back/forward sub-path nav, 11 contract checks), CI green. Tests: ErsatzTV.Tests 828, web 330.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: timothy/ersatztv#161