diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-08-25 15:50:20 +0200 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-08-25 15:50:20 +0200 |
commit | 66c4526d120b52ba8cf6a53196477b99d4cffaca (patch) | |
tree | 96da6175468425523e0f4ddda6e3aaeae6b2a50a /src/download | |
parent | fix(downloader): Remove useless logs (diff) | |
download | yt-66c4526d120b52ba8cf6a53196477b99d4cffaca.tar.gz yt-66c4526d120b52ba8cf6a53196477b99d4cffaca.zip |
fix(downloader): Fallback to calculating the video size, before using hardcoded value
Diffstat (limited to '')
-rw-r--r-- | src/download/mod.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/download/mod.rs b/src/download/mod.rs index faf4f37..b2d0b06 100644 --- a/src/download/mod.rs +++ b/src/download/mod.rs @@ -245,6 +245,13 @@ impl Downloader { val } else if let Some(val) = result.filesize_approx { val + } else if result.duration.is_some() && result.tbr.is_some() { + let duration = result.duration.expect("Is some").ceil() as u64; + + // TODO: yt_dlp gets this from the format + let tbr = result.tbr.expect("Is Some").ceil() as u64; + + duration * tbr * (1000 / 8) } else { let hardcoded_default = Bytes::from_str("250 MiB").expect("This is hardcoded"); error!( |