diff --git a/src/main.rs b/src/main.rs index 0cddd31..d359c15 100644 --- a/src/main.rs +++ b/src/main.rs @@ -36,7 +36,7 @@ struct Champion { #[derive(Deserialize)] struct ChampInfo { - /*id: String*/ + name: String, } #[derive(Serialize, Deserialize)] @@ -114,7 +114,14 @@ fn main() { let path = lol_champs_dir.join(&id).join("Recommended"); fs::create_dir_all(&path).unwrap(); for pos in positions { - write_item_set(&id, &pos, &patch, &path, &client); + write_item_set( + &id, + &champion.data.get(id).unwrap().name, + &pos, + &patch, + &path, + &client, + ); thread::sleep(Duration::from_millis(300)); } } else { @@ -205,8 +212,15 @@ fn make_item_set_from_list(list: &Vec, label: &str, key: &str, data: &Value }) } -fn write_item_set(id: &str, pos: &str, ver: &str, path: &PathBuf, client: &reqwest::Client) { - info!("Retrieving data for {} at {}", id, pos); +fn write_item_set( + id: &str, + name: &str, + pos: &str, + ver: &str, + path: &PathBuf, + client: &reqwest::Client, +) { + info!("Retrieving data for {} at {}", name, pos); let data = get_champ_data(id, pos, client); match data { @@ -247,7 +261,7 @@ fn write_item_set(id: &str, pos: &str, ver: &str, path: &PathBuf, client: &reqwe &data, )); - info!("Writing item set for {} at {}", id, pos); + info!("Writing item set for {} at {}", name, pos); fs::write( path.join(format!("CGG_{}_{}.json", id, pos)), serde_json::to_string_pretty(&item_set).unwrap(),