mod errors; pub mod feed; pub mod fetch; pub mod history; pub mod prelude; mod subscriptions; use feed::{FeedFind, FeedGet}; use fetch::FetchDownload; use history::{HistoryAdd, HistoryFind}; use prelude::*; pub fn run( subscriptions: &str, history: &str, site: &str, feed_find: FeedFind, feed_get: FeedGet, history_find: HistoryFind, history_add: HistoryAdd, fetch_download: FetchDownload, ) -> Result<()> { for channel_name in subscriptions::lines_from(subscriptions)? { 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_find(&link, history)? { println!("Downloading {}: {}", &channel_name, entry.title().as_str()); fetch_download(&link)?; history_add(&link, history)?; } } } } Ok(()) }