diff --git a/src/main.rs b/src/main.rs index 3bed63a..8150a7d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -33,15 +33,17 @@ async fn main() { let update = config.update.map(Duration::from_secs); let sleep = config.sleep.map(Duration::from_secs); let mut database = Database::new(&config.database).unwrap(); - let rp = RustyPipe::new(); loop { + info!("begin {} channels update...", config.channel.len()); for (c, channel) in &config.channel { - debug!("handle channel `{c}` ({})...", channel.id); + debug!("get `{c}` ({})...", channel.id); match rp.query().channel_videos(&channel.id).await { Ok(result) => { - for item in result.content.items { + let items = result.content.items; + debug!("received {:?} items to handle...", items.len()); + for item in items { if database.is_processed(&item.id).is_ok_and(|r| r) { debug!( "item `{}` for channel `{c}` already processed; skip handle.", @@ -79,7 +81,7 @@ async fn main() { String::from_utf8_lossy(&response.stdout).contains(s) }) { match database.process(&item.id) { - Ok(()) => debug!( + Ok(()) => info!( "exec `{cmd}` for channel `{c}` successful: `{:?}`", response ), @@ -117,14 +119,14 @@ async fn main() { } match update { Some(duration) => { - debug!( + info!( "queue completed; await {} seconds to continue...", duration.as_secs() ); thread::sleep(duration) } None => { - debug!("all tasks completed; exit."); + info!("all tasks completed; exit."); break; } }