mod errors; pub mod feed; mod fetch; mod history; pub mod prelude; mod subscriptions; use prelude::*; pub fn run( subscriptions: &str, history: &str, site: &str, feed_find: feed::FeedFind, feed_get: feed::FeedGet, ) -> Result<()> { for channel_name in subscriptions::lines_from(subscriptions)? { let channel_name = channel_name?; println!("Channel: {}", channel_name); let feed_url = feed_find(site, &channel_name)?; for entry in feed_get(&feed_url)?.entries() { if let Some(link) = entry.links().get(0).cloned() { if !history::is_already_downloaded(&link, history)? { println!("Downloading {}: {}", &channel_name, entry.title().as_str()); fetch::download_audio(&link)?; history::mark_as_downloaded(&link, history)?; } } } } Ok(()) }