can't recall what I was doing
This commit is contained in:
parent
097745aeed
commit
5d56e8ecc0
2 changed files with 54 additions and 23 deletions
15
src/main.rs
15
src/main.rs
|
@ -58,11 +58,15 @@ struct Config {
|
|||
}
|
||||
|
||||
impl Config {
|
||||
fn downloads(&self) -> impl Iterator<Item = SimpleDownload> {
|
||||
fn downloads(&self, now: DateTime<chrono_tz::Tz>) -> impl Iterator<Item = SimpleDownload> {
|
||||
self.campfires
|
||||
.iter()
|
||||
.map(|cf| cf.dl.clone())
|
||||
.chain(self.common_ninjas.iter().map(|cn| cn.simple_download()))
|
||||
.chain(
|
||||
self.common_ninjas
|
||||
.iter()
|
||||
.map(move |cn| cn.simple_download(now)),
|
||||
)
|
||||
.chain(self.icals.iter().map(|ical| ical.dl.clone()))
|
||||
}
|
||||
}
|
||||
|
@ -434,12 +438,14 @@ static APP_USER_AGENT: &str = concat!(
|
|||
async fn do_everything(cli: &CliAuto) -> Result<()> {
|
||||
let config = std::fs::read_to_string(&cli.config)?;
|
||||
let config: Config = toml::from_str(&config)?;
|
||||
let tz = &config.output.timezone;
|
||||
let now = Utc::now().with_timezone(tz);
|
||||
|
||||
tracing::info!(?APP_USER_AGENT);
|
||||
let client = reqwest::Client::builder()
|
||||
.user_agent(APP_USER_AGENT)
|
||||
.build()?;
|
||||
for dl in config.downloads() {
|
||||
for dl in config.downloads(now) {
|
||||
let Some(download_url) = &dl.download_url else {
|
||||
continue;
|
||||
};
|
||||
|
@ -456,9 +462,6 @@ async fn do_everything(cli: &CliAuto) -> Result<()> {
|
|||
}
|
||||
|
||||
let data = read_data_from_disk(&config)?;
|
||||
|
||||
let tz = &config.output.timezone;
|
||||
let now = Utc::now().with_timezone(tz);
|
||||
let instances = process_data(&data, &config.output, now)?;
|
||||
output_html(&config.output, &instances, now)?;
|
||||
Ok(())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue