diff options
| author | salmonik <salmonik@tuta.io> | 2026-11-04 01:31:11 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-11-04 01:31:11 +0100 |
| commit | b9eaa579dac2ae912e3be9a3aa3e73ddcb3416e1 (patch) | |
| tree | 6082f23150d0c64ae1ac8aeebc5393468263ad82 /src/music.rs | |
| parent | tts: attach the generated WAV without a temp file (diff) | |
| download | senator-sperma-b9eaa579dac2ae912e3be9a3aa3e73ddcb3416e1.tar.gz senator-sperma-b9eaa579dac2ae912e3be9a3aa3e73ddcb3416e1.zip | |
music: decode compressed playback without a temp file
Diffstat (limited to 'src/music.rs')
| -rw-r--r-- | src/music.rs | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/music.rs b/src/music.rs index ac88631..acec278 100644 --- a/src/music.rs +++ b/src/music.rs | |||
| @@ -575,14 +575,8 @@ async fn build_input(request: &TrackRequest, http: &reqwest::Client) -> Result<I | |||
| 575 | info!("compressed to {} bytes", compressed_bytes.len()); | 575 | info!("compressed to {} bytes", compressed_bytes.len()); |
| 576 | 576 | ||
| 577 | // Decode the compressed OGG via ffmpeg (symphonia lacks Opus support). | 577 | // Decode the compressed OGG via ffmpeg (symphonia lacks Opus support). |
| 578 | let compressed_path = format!( | 578 | // Piping keeps the intermediate out of TEMP_PATH entirely. |
| 579 | "{}/play_compressed_{}.ogg", | 579 | let input = voice::ffmpeg_decode_bytes(compressed_bytes).await?; |
| 580 | crate::config::TEMP_PATH, | ||
| 581 | Uuid::new_v4() | ||
| 582 | ); | ||
| 583 | let _ = tokio::fs::create_dir_all(crate::config::TEMP_PATH).await; | ||
| 584 | tokio::fs::write(&compressed_path, &compressed_bytes).await?; | ||
| 585 | let input = voice::ffmpeg_decode_file(&compressed_path).await?; | ||
| 586 | Ok(input) | 580 | Ok(input) |
| 587 | } else { | 581 | } else { |
| 588 | match request.kind { | 582 | match request.kind { |
