From 4a02bd089b64e344d93f6ee514fb47e7da83ff10 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Wed, 11 Dec 2024 12:12:53 +0100 Subject: [PATCH] mpv_setup: add ytdl hook args --- src/mpv_setup.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/mpv_setup.rs b/src/mpv_setup.rs index 0ed40e2..ecfafdd 100644 --- a/src/mpv_setup.rs +++ b/src/mpv_setup.rs @@ -11,6 +11,9 @@ const DEFAULT_MPV_CONFIG_CONTENT: &str = include_str!("../assets/default-mpv.con const THE_MAN_PNG: &[u8] = include_bytes!("../assets/the_man.png"); +// https://mpv.io/manual/master/#options-ytdl +const YTDL_HOOK_ARGS: [&str; 2] = ["try_ytdl_first=yes", "thumbnails=none"]; + pub fn create_mpv_config_file(args_config_file: Option) -> anyhow::Result { let file_content = if let Some(path) = args_config_file { if !Path::new(&path).exists() { @@ -78,6 +81,13 @@ pub async fn connect_to_mpv<'a>( .arg("--force-window") .arg("--fullscreen") .arg("--no-config") + .arg("--ytdl=yes") + .args( + YTDL_HOOK_ARGS + .into_iter() + .map(|x| format!("--script-opts=ytdl_hook-{}", x)) + .collect::>(), + ) .arg(format!( "--include={}", &args.config_file.path().to_string_lossy() @@ -132,4 +142,3 @@ pub async fn show_grzegorz_image(mpv: Mpv) -> anyhow::Result<()> { Ok(()) } -