use champ name for log
This commit is contained in:
parent
6947fbe05a
commit
444f6333b5
1 changed files with 19 additions and 5 deletions
24
src/main.rs
24
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<u32>, 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(),
|
||||
|
|
Loading…
Add table
Reference in a new issue