-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathdownload_bbc.rs
More file actions
39 lines (36 loc) · 1.16 KB
/
Copy pathdownload_bbc.rs
File metadata and controls
39 lines (36 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// download_bbc.rs
//
// Run with `cargo run --example download_bbc`
//
// Check the extended attributes associated with the downloaded file (on Unix platforms)
// with "xattr -l <output-path>"
use std::process;
use tracing_subscriber::EnvFilter;
use tracing_subscriber::prelude::*;
use dash_mpd::fetch::DashDownloader;
#[tokio::main]
async fn main () {
let fmt_layer = tracing_subscriber::fmt::layer()
.compact();
let filter_layer = EnvFilter::try_from_default_env()
.or_else(|_| EnvFilter::try_new("info,reqwest=warn"))
.unwrap();
tracing_subscriber::registry()
.with(filter_layer)
.with(fmt_layer)
.init();
// this is a 442MB file
let url = "https://rdmedia.bbc.co.uk/testcard/vod/manifests/avc-ctv-stereo-en.mpd";
let ddl = DashDownloader::new(url)
.worst_quality()
.verbosity(2);
#[cfg(target_os = "windows")]
let ddl = ddl.with_vlc("C:/Program Files/VideoLAN/VLC/vlc.exe");
match ddl.download().await {
Ok(path) => println!("Downloaded to {path:?}"),
Err(e) => {
eprintln!("Download failed: {e:?}");
process::exit(-1);
},
}
}