about summary refs log tree commit diff stats
path: root/src/download/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/download/mod.rs')
-rw-r--r--src/download/mod.rs7
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!(