diff options
Diffstat (limited to 'crates/yt_dlp/src/lib.rs')
-rw-r--r-- | crates/yt_dlp/src/lib.rs | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/crates/yt_dlp/src/lib.rs b/crates/yt_dlp/src/lib.rs index 970bfe2..88ef996 100644 --- a/crates/yt_dlp/src/lib.rs +++ b/crates/yt_dlp/src/lib.rs @@ -198,7 +198,7 @@ pub fn progress_hook(py: Python<'_>, input: &Bound<'_, PyDict>) -> PyResult<()> format!("{bytes}/s") } - let get_title = |add_extension: bool| -> String { + let get_title = || -> String { match get! {is_string, as_str, "info_dict", "ext"} { "vtt" => { format!( @@ -206,16 +206,8 @@ pub fn progress_hook(py: Python<'_>, input: &Bound<'_, PyDict>) -> PyResult<()> default_get! {as_str, "<No Subtitle Language>", "info_dict", "name"} ) } - title_extension @ ("webm" | "mp4" | "m4a") => { - if add_extension { - format!( - "{} ({})", - default_get! { as_str, "<No title>", "info_dict", "title"}, - title_extension - ) - } else { - default_get! { as_str, "<No title>", "info_dict", "title"}.to_owned() - } + "webm" | "mp4" | "mp3" | "m4a" => { + default_get! { as_str, "<No title>", "info_dict", "title"}.to_owned() } other => panic!("The extension '{other}' is not yet implemented"), } @@ -259,7 +251,7 @@ pub fn progress_hook(py: Python<'_>, input: &Bound<'_, PyDict>) -> PyResult<()> print!( "'{}' [{}/{} at {}] -> [{} of {}{} {}] ", - c!("34;1", get_title(true)), + c!("34;1", get_title()), c!("33;1", Duration::from(Some(elapsed))), c!("33;1", Duration::from(Some(eta))), c!("32;1", format_speed(speed)), @@ -274,7 +266,7 @@ pub fn progress_hook(py: Python<'_>, input: &Bound<'_, PyDict>) -> PyResult<()> println!("-> Finished downloading."); } "error" => { - panic!("-> Error while downloading: {}", get_title(true)) + panic!("-> Error while downloading: {}", get_title()) } other => unreachable!("'{other}' should not be a valid state!"), }; |