use lodestone-fetcher
parent
3811f0af15
commit
0c75859cd2
11
src/main.rs
11
src/main.rs
|
@ -4,11 +4,16 @@ mod raw_data;
|
|||
use crate::compile_data::{DpsRole, JobStats, Role};
|
||||
use crate::raw_data::RawJobStats;
|
||||
|
||||
use std::fs::File;
|
||||
use std::process::{Command, Stdio};
|
||||
|
||||
fn get_job_stats(lodestone_id: usize) -> anyhow::Result<Vec<JobStats>> {
|
||||
let file = File::open(format!("./data/{lodestone_id}.json"))?;
|
||||
let raw: Vec<RawJobStats> = serde_json::from_reader(file)?;
|
||||
let output = Command::new("lodestone-fetcher")
|
||||
.arg(lodestone_id.to_string())
|
||||
.stdout(Stdio::piped())
|
||||
.output()
|
||||
.expect("Failed to execute lodestone-fetcher");
|
||||
|
||||
let raw: Vec<RawJobStats> = serde_json::from_reader(&output.stdout[..])?;
|
||||
|
||||
Ok(raw.into_iter().map(|r| r.into()).collect())
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue