Browse Source

Log changes

main
Georg Hopp 11 months ago
parent
commit
d6ccd70d44
Signed by: ghopp GPG Key ID: 4C5D226768784538
  1. 15
      src/main.rs

15
src/main.rs

@ -39,12 +39,12 @@ async fn main() -> anyhow::Result<()> {
. write_style_or("LOG_STYLE", "always");
env_logger::init_from_env(env);
log!(Level::Info, "-> Parse command line arguments...");
log!(Level::Info, "Parse command line arguments...");
let args = Args::parse();
log!(Level::Debug, "-> Arguments: {:?}", args);
log!(Level::Debug, "Arguments: {:?}", args);
log!(Level::Info, "-> Creating an HTTP client with Tower layers...");
log!(Level::Info, "Creating an HTTP client with Tower layers...");
let concurrency = args.concurrency.unwrap_or(10);
let timeout = args.timeout.unwrap_or(10);
@ -55,15 +55,15 @@ async fn main() -> anyhow::Result<()> {
. ok_or(anyhow!("Problem path and query in m3u8 uri"))?;
let mut state = client::State::new(&m3u8_uri, concurrency, timeout)?;
log!(Level::Info, "-> Get segments...");
log!(Level::Info, "Get segments...");
let mut segments = state.get_m3u8_segment_uris(m3u8_path_and_query.as_str()).await?;
log!(Level::Info, "-> Sending concurrent requests...");
log!(Level::Info, "Sending concurrent requests...");
let mut join_set = JoinSet::new();
while let Some(segment) = segments.pop() {
log!(Level::Info, " -> Spawn task for: {}", segment);
log!(Level::Info, "Spawn task for: {}", segment);
let mut state = state.clone();
join_set.spawn(async move {
state.get_m3u8_segment(&segment).await
@ -78,8 +78,7 @@ async fn main() -> anyhow::Result<()> {
},
Ok(Err(e)) => {
log!(Level::Warn, "Retry failed download: {:?}", e);
log!(Level::Info, " -> Spawn task for: {}", e.uri);
log!(Level::Info, "Retry failed download: {:?}", e);
let mut state = state.clone();
join_set.spawn(async move {
state.get_m3u8_segment(&e.uri).await

Loading…
Cancel
Save