feat: rebuild AudioManager around downloadable moods
CI / chart (push) Successful in 3s
CI / test (push) Successful in 2m2s
CI / chart-push (push) Successful in 4s
CI / image (push) Successful in 3m20s

- V8 wipe migration and the shared song store keyed by YouTube video id
- media store, indexer, downloader, recommendation top-up and refcounted GC
- mood songs plus the recommendation lifecycle and mixed radio pools
- new search, song and recommendation API; remove library/longform/seed routes
- chart PVC/media env, docs, Nix, README and an end-to-end smoke test
This commit is contained in:
TapTap committed 2026-11-15 21:37:39 +00:00
1 parent 50d8b6c580
commit 824eb36dd2
59 files changed
+3838 -5276

No files matched your search

+55
View File
@@ -600,3 +600,58 @@ Client:
- A recommendation that is `added` while downloading must not turn into a
duplicate collection row.
- The migration is destructive by design; document it prominently.
## Implementation status (2026-11-15)
Phases 1-8 are implemented in both repositories.
### Server
- `V8__mood_first.sql` drops the mounted-library schema and creates
`songs`, `moods`, `mood_songs`, `mood_recommendations`, `download_jobs`,
playback tables and `song_affinity`. Users and device tokens survive.
The `mood_recommendations` table has an additional `rank` column so
promotion follows the discovery score order.
- `SongRepository` dedupes by video id and is the only song table access.
- `MediaStore` owns `<MEDIA_DIR>/<videoId>/<title>.mp3`; `SongIndexer` is shared
by the scanner and the downloader.
- `MoodRepository` implements the song collection, hidden `new` candidates,
active slots and the add/reject/retry lifecycle.
- `DiscoveryService` + `TopUpService` implement collection-based discovery and
slot refills. `TopUpService` coalesces work behind a mutex and can be triggered
fire-and-forget from API handlers.
- `DownloadService` is a single global worker with `song` jobs outranking
`recommendation` jobs. It indexes immediately after moving the file.
- `MediaGcService` implements refcounted deletion (moods, active recommendations,
open sessions).
- The API surface is the one in section 4.8. Differences: search returns
`{"results": [...]}`, recommendation decisions are `add`/`reject`/`retry`, and
covers use `/songs/{id}/cover`. `/moods/{id}/songs` returns `202` with
`downloading: true` when a new video was queued.
- `AppConfig` is `port`, `dataDir`, `usersFile`, `ffmpegPath`, `ytDlpPath`,
`mediaDir`, `downloadDir`. `LibraryConfig` and the folder APIs are deleted.
- Background loops: download worker (continuous), recommendation top-up
(hourly), media GC (hourly), startup scan.
- Chart 0.3.0 uses one `/data` PVC, `MEDIA_DIR=/data/media`, no hostPath, no
library ConfigMap and no init container.
- Tests: 73 server tests, 48-step smoke test with a fake `yt-dlp`.
### Client
- Models, `ApiClient`, `AppCache` (version 2) and `AppStore` match the new API.
- Screens are `Moods | MoodDetail | Search | Downloads | Settings`.
`LibraryScreen`, longform UI, seed management and global shuffle are gone.
- Search supports a target-mood picker, downloaded badges and paste-a-URL.
- Mood detail shows songs, add music, recommendation states (Add / Not
interested / Retry), next batch and the new options.
- Playback, sleep timer, queue editing, Android media session and device
downloads are unchanged apart from song-keyed covers.
- Tests: 16 client tests; desktop, Android debug and Wasm compile.
### Known follow-ups
- Real-device Android background playback and desktop audio checks still need a
machine with an audio device.
- Automatic downloads are bounded by `recommendationCount` but can still consume
noticeable disk/bandwidth for unplayed moods.
- yt-dlp bot checks remain an operational risk; failed rows keep Retry.