feat: search and download from YouTube Music
CI / chart (push) Successful in 3s
CI / test (push) Successful in 2m6s
CI / chart-push (push) Successful in 4s
CI / image (push) Successful in 3m25s

- search music.youtube.com with the Songs filter and resolve each hit so
  results carry canonical artist, album and duration
- fall back to plain ytsearch when the Music search fails
- download the Music watch URL first and the regular YouTube URL second
- parse explicit artist fields and drop channel/album/playlist entries
- update the smoke stub, docs and tests
This commit is contained in:
TapTap committed 2026-11-16 18:38:53 +00:00
1 parent 61d8b58223
commit 515b9bbe1b
6 files changed
+215 -29

No files matched your search

+10 -4
View File
@@ -13,8 +13,9 @@ Repos:
- Users have **moods only**. There is no mounted music directory, no file
upload and no longform/podcast content.
- All content enters the server by downloading from YouTube through `yt-dlp`.
- Search is a remote YouTube-Music-style search. Results are shown before
- All content enters the server by downloading from YouTube Music through
`yt-dlp` (regular YouTube is only a fallback host).
- Search is a remote YouTube Music search. Results are shown before
anything is added.
- A mood contains:
- **Songs** — the user's collection. Added from search, from a recommendation,
@@ -104,7 +105,7 @@ Current files and responsibilities, and what happens to them:
| `db/RadioRepository.kt` | sessions, items, affinity | keep, minus folder/library assumptions |
| `db/DownloadRepository.kt` | per-user/mood jobs, longform progress | rewrite job model; move longform repository out |
| `discovery/DiscoveryService.kt` | seeds + genres/query -> candidates, review | same inputs from collection; store `new` candidates; no `matchedSongId` library matching |
| `discovery/YtSearch.kt` | yt-dlp flat search | keep; change music length to 45..600s; add URL resolve |
| `discovery/YtSearch.kt` | yt-dlp flat search | YouTube Music songs search with resolved metadata; regular `ytsearch` fallback; add URL resolve |
| `download/DownloadService.kt` | accept -> import folder -> scan -> seed | index directly into media store; attach song/recommendation; GC on failure |
| `download/YtDlpDownloader.kt` | MP3 + embedded metadata | keep; target `<videoId>/<title>.mp3` |
| `scanner/MediaScanner.kt` | walks folder config | walks `MEDIA_DIR`; derive video id from path |
@@ -630,11 +631,16 @@ Phases 1-8 are implemented in both repositories.
`downloading: true` when a new video was queued.
- `AppConfig` is `port`, `dataDir`, `usersFile`, `ffmpegPath`, `ytDlpPath`,
`mediaDir`, `downloadDir`. `LibraryConfig` and the folder APIs are deleted.
- `YtDlpSearch` searches `music.youtube.com` with the Songs filter and resolves
each hit, so results carry the canonical artist, album and duration.
`YtDlpDownloader` requests the Music watch URL first and falls back to
`www.youtube.com` for videos that are not on the Music host. If the Music
search itself fails, search falls back to `ytsearch`.
- 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`.
- Tests: 75 server tests, 48-step smoke test with a fake `yt-dlp`.
### Client