From 7b7e7f6b167a257d10f695057ce0495443c2b256 Mon Sep 17 00:00:00 2001 From: Collins Muriuki Date: Tue, 1 Jul 2025 17:39:10 +0300 Subject: [PATCH 1/4] Improve error reporting --- crates/stream_pulse/src/lib/process_stream.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/stream_pulse/src/lib/process_stream.rs b/crates/stream_pulse/src/lib/process_stream.rs index 38da369..e64f8fa 100644 --- a/crates/stream_pulse/src/lib/process_stream.rs +++ b/crates/stream_pulse/src/lib/process_stream.rs @@ -131,9 +131,11 @@ fn handle_stream_audio( // Skip download if .mp3 already exists if !audio_mp3_path.exists() { - if let Err(e) = ytdlp.download_audio(&youtube_stream, &audio_base_path) { - tracing::error!(error = ?e, "Failed to download video"); - bail!("Failed to download video: {:?}", e); + if let Err(e) = ytdlp + .download_audio(&youtube_stream, &audio_base_path) + .inspect_err(|e| tracing::error!(error = ?e, "Failed to download audio")) + { + bail!("Failed to download audio: {:?}", e); }; } else { tracing::debug!("Audio already exists at {:?}", audio_mp3_path); From 3b493b5056947b94f7192108fa0514da036708a1 Mon Sep 17 00:00:00 2001 From: Collins Muriuki Date: Tue, 1 Jul 2025 17:44:59 +0300 Subject: [PATCH 2/4] Fix clippy warnings --- crates/ytdlp_bindings/build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/ytdlp_bindings/build.rs b/crates/ytdlp_bindings/build.rs index 0d8c649..c5cdb5a 100644 --- a/crates/ytdlp_bindings/build.rs +++ b/crates/ytdlp_bindings/build.rs @@ -19,7 +19,7 @@ fn main() -> Result<(), Box> { ("linux", "x86_64" | "x86") => "yt-dlp_linux", ("linux", "aarch64") => "yt-dlp_linux_aarch64", ("linux", "arm") => "yt-dlp_linux_armv7I", - _ => return Err(format!("Unsupported platform: {} {}", target_os, target_arch).into()), + _ => return Err(format!("Unsupported platform: {target_os} {target_arch}").into()), }; // Create an output directory for the binary From 593c41c8aff304968659513b78ca3e1632d5cc44 Mon Sep 17 00:00:00 2001 From: Collins Muriuki Date: Tue, 1 Jul 2025 20:05:54 +0300 Subject: [PATCH 3/4] Fix clippy warnings...again --- crates/ytdlp_bindings/src/processors/video.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/ytdlp_bindings/src/processors/video.rs b/crates/ytdlp_bindings/src/processors/video.rs index 30d5455..4b700aa 100644 --- a/crates/ytdlp_bindings/src/processors/video.rs +++ b/crates/ytdlp_bindings/src/processors/video.rs @@ -75,7 +75,7 @@ impl VideoProcessor for YtDlp { let output_str = output_template.as_ref().to_str().ok_or_else(|| { YtDlpError::InvalidPath(output_template.as_ref().display().to_string()) })?; - let fps = format!("fps={}", fps); + let fps = format!("fps={fps}"); let extra_args = extra_args.map(|args| args.join(" ")).unwrap_or_default(); // ffmpeg -i input_video.mp4 -vf fps=1/10 output_%04d.png From 8f54c9d11a6bd583f77122522d2cb9213feb538d Mon Sep 17 00:00:00 2001 From: Collins Muriuki Date: Tue, 1 Jul 2025 20:06:20 +0300 Subject: [PATCH 4/4] Fix typo in docs --- crates/ytdlp_bindings/src/processors/video.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/ytdlp_bindings/src/processors/video.rs b/crates/ytdlp_bindings/src/processors/video.rs index 4b700aa..3a3765f 100644 --- a/crates/ytdlp_bindings/src/processors/video.rs +++ b/crates/ytdlp_bindings/src/processors/video.rs @@ -6,7 +6,7 @@ use crate::{error::YtDlpError, YtDlp}; use std::path::Path; /// A trait for processing video files. -/// Requires `ffmpeg` v7* available in the evironment +/// Requires `ffmpeg` v7* available in the environment pub trait VideoProcessor { /// Converts a video to a different format. ///