feat: discover YT recommendations and tune the radio
yt-dlp now feeds mood discovery. Queries come from the free-text hint, seed artists and genres; they run in parallel, are filtered to music-length videos, matched against library songs by normalized title and artist, scored, and stored as review candidates. Refresh, accept and reject endpoints are added: accepting a library match adds a seed immediately, while accepted tracks that are not owned wait for the future downloader. Decisions survive refreshes and stale undecided candidates are pruned. A background pass refreshes stale moods every hour, and the image ships a pinned yt-dlp binary (YTDLP_PATH, also added to the Nix shell and chart). Radio now avoids tracks played in the last 7 days when the pool is large enough, spaces artists and albums across a batch, and weighs skips three times as heavily as completions. The chart moves to 0.2.2.
This commit is contained in:
1 parent
67eed8d262
commit
c5aa000d1a
18 files changed
+1061
-37
No files matched your search
@@ -109,6 +109,7 @@ Passwords are read into memory at startup and never written to SQLite. In produc
|
||||
| `LIBRARY_CONFIG` | `./config/library.yaml` | Library folders |
|
||||
| `USERS_FILE` | `./config/users.yaml` | Users and passwords |
|
||||
| `FFMPEG_PATH` | `ffmpeg` | Transcoder binary |
|
||||
| `YTDLP_PATH` | `yt-dlp` | `yt-dlp` binary used for YT Music discovery |
|
||||
|
||||
## The mood model
|
||||
|
||||
@@ -117,8 +118,8 @@ A mood is a private collection owned by one user:
|
||||
- **Seeds** are permanent anchors. Every seed is always eligible for the radio.
|
||||
- **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.
|
||||
- **Signals** come from playback: completed tracks gain weight, skipped tracks lose weight. There are no likes.
|
||||
- **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.
|
||||
- **Signals** come from playback: completed tracks gain weight, skips weigh three times as much. There are no likes.
|
||||
- **Add to mood** is explicit. The client offers *add to current mood* and *choose another mood*, and the server turns the track into a manual seed.
|
||||
- **Long-form is excluded** at seed validation and radio generation.
|
||||
|
||||
@@ -175,7 +176,10 @@ Song objects contain deterministic IDs (`sg-…`), album/artist names, duration,
|
||||
- `POST /moods/{id}/seeds` — `{ songId }`
|
||||
- `DELETE /moods/{id}/seeds/{songId}`
|
||||
- `GET /moods/{id}/preview?limit=20` — unpersisted radio preview.
|
||||
- `GET /moods/{id}/recommendations` — YT Music candidates (see roadmap).
|
||||
- `GET /moods/{id}/recommendations` — YT Music candidates with state and matched library song.
|
||||
- `POST /moods/{id}/recommendations/refresh` — run discovery now (bypasses `refreshHours`).
|
||||
- `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.
|
||||
|
||||
### Radio sessions
|
||||
|
||||
@@ -201,6 +205,9 @@ src/main/kotlin/win/taptap/musicmanager/
|
||||
| |-- AppConfig.kt # Port, data dir, ffmpeg, env overrides
|
||||
| |-- LibraryConfig.kt # Folder IDs, types and paths
|
||||
| `-- UsersConfig.kt # Users, admins and folder assignments
|
||||
|-- discovery/
|
||||
| |-- YtSearch.kt # yt-dlp search and result parsing
|
||||
| `-- DiscoveryService.kt # Queries, matching, scoring, pruning
|
||||
|-- api/
|
||||
| |-- ApiRoutes.kt # /api/v1 wiring, auth and system endpoints
|
||||
| |-- ApiModels.kt # Native DTOs
|
||||
@@ -223,6 +230,8 @@ src/main/kotlin/win/taptap/musicmanager/
|
||||
`-- util/ # Deterministic IDs, sort names
|
||||
```
|
||||
|
||||
YT discovery runs in the background for stale moods (`refreshHours`) and on demand from the mood screen. Queries come from the mood text, seed artists and genres; results are deduplicated, filtered to music-length videos, matched to library songs by normalized title and artist, and scored. Undecided candidates not seen in a refresh are pruned; accepted and rejected decisions are permanent. Accepted tracks that are not in the library wait for the future downloader, which will drop them into an import folder and rescan.
|
||||
|
||||
The old OpenSubsonic layer (`/rest`, `subsonic/`, playlist materialization) was removed in 0.2.0. The server and the KMP client are the two halves of the same product; there is no compatibility layer to preserve and no server-rendered UI.
|
||||
|
||||
## Database
|
||||
@@ -324,7 +333,7 @@ The smoke test generates tagged MP3s, starts the server, and verifies login, syn
|
||||
- [x] Native bearer-auth API, sync deltas, tombstones.
|
||||
- [x] Mood CRUD, seeds, server-driven radio, playback events, add-to-mood.
|
||||
- [x] Kotlin Multiplatform client foundation (Android, desktop, web).
|
||||
- [ ] Offline downloads and offline playback across clients.
|
||||
- [ ] YT Music discovery through `yt-dlp`, recommendation list, accept/reject.
|
||||
- [x] Offline downloads and offline playback across clients.
|
||||
- [x] YT Music discovery through `yt-dlp`, recommendation list, accept/reject.
|
||||
- [ ] Optional downloader that writes accepted tracks into an import folder and rescans.
|
||||
- [ ] Home-screen widgets, Android Auto, and richer radio tuning.
|
||||
Reference in new issue
Block a user