feat: rebuild AudioManager around downloadable moods
- 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:
1 parent
50d8b6c580
commit
824eb36dd2
59 files changed
+3838
-5276
No files matched your search
@@ -7,14 +7,19 @@ import kotlin.concurrent.thread
|
||||
|
||||
/**
|
||||
* Downloads a single YouTube video as an MP3 with embedded metadata, so the
|
||||
* scanner can derive artist and title from the file itself.
|
||||
* indexer can derive artist and title from the file itself.
|
||||
*/
|
||||
fun interface AudioDownloader {
|
||||
/** Downloads [videoId] into [targetDir] and returns the resulting MP3 file. */
|
||||
fun download(videoId: String, targetDir: Path): Path
|
||||
}
|
||||
|
||||
class YtDlpDownloader(
|
||||
private val executable: String,
|
||||
private val timeoutSeconds: Long = 600,
|
||||
) : AudioDownloader {
|
||||
|
||||
override fun download(videoId: String, title: String, artist: String, targetDir: Path): Path {
|
||||
override fun download(videoId: String, targetDir: Path): Path {
|
||||
Files.createDirectories(targetDir)
|
||||
val process = ProcessBuilder(
|
||||
executable,
|
||||
@@ -62,9 +67,7 @@ class YtDlpDownloader(
|
||||
errorReader.join(2_000)
|
||||
if (process.exitValue() != 0) {
|
||||
val detail = (errors.toString().ifBlank { output.toString() }).take(400).trim()
|
||||
throw IllegalStateException(
|
||||
"yt-dlp exited with ${process.exitValue()}: $detail",
|
||||
)
|
||||
throw IllegalStateException("yt-dlp exited with ${process.exitValue()}: $detail")
|
||||
}
|
||||
|
||||
val printed = output.lines()
|
||||
|
||||
Reference in new issue
Block a user