This commit is contained in:
parent
80bbf9c3df
commit
9577598783
2 changed files with 3 additions and 4 deletions
|
@ -1,10 +1,10 @@
|
||||||
|
use crate::ChampInfo;
|
||||||
use indexmap::IndexMap;
|
use indexmap::IndexMap;
|
||||||
use log::{error, info};
|
use log::{error, info};
|
||||||
use serde_derive::{Deserialize, Serialize};
|
use serde_derive::{Deserialize, Serialize};
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use crate::ChampInfo;
|
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
struct ItemSet {
|
struct ItemSet {
|
||||||
|
|
|
@ -35,7 +35,7 @@ struct Champion {
|
||||||
pub struct ChampInfo {
|
pub struct ChampInfo {
|
||||||
id: String,
|
id: String,
|
||||||
name: String,
|
name: String,
|
||||||
key: String
|
key: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
const USER_AGENT_KEY: &str = "User-Agent";
|
const USER_AGENT_KEY: &str = "User-Agent";
|
||||||
|
@ -105,7 +105,6 @@ fn main() {
|
||||||
if !champion.data.contains_key(&champ_id) {
|
if !champion.data.contains_key(&champ_id) {
|
||||||
champ_id = get_champ_from_key(&champion, &champ_id);
|
champ_id = get_champ_from_key(&champion, &champ_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if champion.data.contains_key(&champ_id) {
|
if champion.data.contains_key(&champ_id) {
|
||||||
let path = lol_champs_dir.join(&champ_id).join("Recommended");
|
let path = lol_champs_dir.join(&champ_id).join("Recommended");
|
||||||
fs::create_dir_all(&path).unwrap();
|
fs::create_dir_all(&path).unwrap();
|
||||||
|
@ -126,7 +125,7 @@ fn main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_champ_from_key(champs: &Champion, key: &str) -> String {
|
fn get_champ_from_key(champs: &Champion, key: &str) -> String {
|
||||||
for champ in champs.data.values() {
|
for champ in champs.data.values() {
|
||||||
if key == champ.key {
|
if key == champ.key {
|
||||||
return champ.id.clone();
|
return champ.id.clone();
|
||||||
|
|
Loading…
Add table
Reference in a new issue