feat: mix mood radio by seed percentage and embed download artwork
CI / chart (push) Successful in 3s
CI / chart-push (push) Successful in 5s
CI / test (push) Successful in 1m50s
CI / image (push) Successful in 3m16s

Moods now store a seedPercent (0-100, default 50). RadioService rolls that
share independently for every queued slot: heads picks from the seed songs,
tails from the generated recommendation pool. When one pool is empty the other
fills the batch, so a mood never stalls. The DTO exposes both seedPercent and
the derived recommendationPercent, and create/patch accept seedPercent.

Automatic YT downloads now embed the video thumbnail as MP3 cover art so the
scanner publishes a cover for newly imported tracks.

V7 adds moods.seed_percent.
This commit is contained in:
TapTap committed 2026-11-15 17:07:04 +00:00
1 parent dd7bbde84d
commit c75f2971b4
11 files changed
+146 -6

No files matched your search

+5 -3
View File
@@ -119,6 +119,7 @@ Passwords are read into memory at startup and never written to SQLite. In produc
A mood is a private collection owned by one user:
- **Seeds** are permanent anchors. Every seed is always eligible for the radio.
- **Seed mix** (`seedPercent`, 0–100) chooses how much of each batch comes from the seeds. The rest is filled from the generated recommendation pool (genres, artists, text matches and the rest of the library). Every slot rolls the percentage independently; when one pool is exhausted the other fills in. The default is 50/50.
- **Genres / free-text hint** widen the candidate pool.
- **Target size** is the desired batch and session size, not a hard playlist length.
- **Radio** is generated by the server for each playback session. It mixes seeds, related genres and artists, text matches, and the rest of the owner's music. Tracks started, finished or skipped in the last 7 days are skipped while the library is large enough, and artists/albums are spaced across the batch.
@@ -172,9 +173,10 @@ Song objects contain deterministic IDs (`sg-…`), album/artist names, duration,
### Moods
- `GET /moods`
- `POST /moods` — `{ name, description?, query?, genres[], targetSize, refreshHours, ytEnabled, seedSongIds[] }`
- `POST /moods` — `{ name, description?, query?, genres[], targetSize, refreshHours, ytEnabled, seedSongIds[], seedPercent? }`
- `seedPercent` is 0–100 (default 50); the mood DTO also reports `recommendationPercent = 100 - seedPercent`.
- `GET /moods/{id}` — mood, seeds and recommendations.
- `PATCH /moods/{id}` — partial settings update; `clearDescription` / `clearQuery` clear fields.
- `PATCH /moods/{id}` — partial settings update, including `seedPercent`; `clearDescription` / `clearQuery` clear fields.
- `DELETE /moods/{id}`
- `POST /moods/{id}/seeds` — `{ songId }`
- `DELETE /moods/{id}/seeds/{songId}`
@@ -184,7 +186,7 @@ Song objects contain deterministic IDs (`sg-…`), album/artist names, duration,
- `POST /moods/{id}/recommendations/{videoId}/accept` — accept; the library match becomes a seed immediately.
- `POST /moods/{id}/recommendations/{videoId}/reject` — reject; the candidate is not offered again.
Accepted recommendations without a library match are queued for download (`download.state` = `queued|downloading|done|failed` in the recommendation). The worker writes MP3s into `<music folder>/AudioManager Imports`, runs a scan, matches the new song, adds it as a seed and updates the recommendation.
Accepted recommendations without a library match are queued for download (`download.state` = `queued|downloading|done|failed` in the recommendation). The worker writes MP3s into `<music folder>/AudioManager Imports`, embeds the video thumbnail as cover art, runs a scan, matches the new song, adds it as a seed and updates the recommendation.
### Radio sessions