aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-11-04 01:31:21 +0100
committersalmonik <salmonik@tuta.io>2026-11-04 01:31:21 +0100
commitf811fed0d65bed62bb1c5a986f6f355d3b68612d (patch)
tree8e1b9ba652f3ce88c5d569b622bea9344e258621
parentmusic: decode compressed playback without a temp file (diff)
downloadsenator-sperma-f811fed0d65bed62bb1c5a986f6f355d3b68612d.tar.gz
senator-sperma-f811fed0d65bed62bb1c5a986f6f355d3b68612d.zip
music: reject live streams on the yt-dlp path
-rw-r--r--src/music.rs7
-rw-r--r--src/voice/mod.rs2
2 files changed, 9 insertions, 0 deletions
diff --git a/src/music.rs b/src/music.rs
index acec278..0b907d3 100644
--- a/src/music.rs
+++ b/src/music.rs
@@ -547,6 +547,13 @@ pub(crate) fn sanitize_yt_url(url: &str) -> String {
547} 547}
548 548
549async fn build_input(request: &TrackRequest, http: &reqwest::Client) -> Result<Input> { 549async fn build_input(request: &TrackRequest, http: &reqwest::Client) -> Result<Input> {
550 // yt-dlp would block forever collecting a live stream into memory (and
551 // `--match-filter !is_live` rejects the remaining cases).
552 if request.kind == SourceKind::YtDlp && is_live_stream_hint(&request.url) {
553 return Err(Error::Custom(
554 "live streams are not supported through yt-dlp".into(),
555 ));
556 }
550 if request.compressed { 557 if request.compressed {
551 let audio_bytes = match request.kind { 558 let audio_bytes = match request.kind {
552 SourceKind::YtDlp => { 559 SourceKind::YtDlp => {
diff --git a/src/voice/mod.rs b/src/voice/mod.rs
index 2866f54..8f73b7a 100644
--- a/src/voice/mod.rs
+++ b/src/voice/mod.rs
@@ -253,6 +253,8 @@ pub async fn ytdlp_download(url: &str) -> Result<Vec<u8>> {
253 "--no-playlist", 253 "--no-playlist",
254 "--max-filesize", 254 "--max-filesize",
255 "128M", 255 "128M",
256 "--match-filter",
257 "!is_live",
256 "--", 258 "--",
257 url, 259 url,
258 ]) 260 ])