This commit is contained in:
parent
411b59071e
commit
c2ff1b9bc4
4 changed files with 10 additions and 13 deletions
|
@ -5,7 +5,7 @@ use log::{error, info};
|
|||
use serde_derive::{Deserialize, Serialize};
|
||||
use serde_json::Value;
|
||||
use std::fs;
|
||||
use std::path::PathBuf;
|
||||
use std::path::Path;
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
struct ItemSet {
|
||||
|
@ -57,7 +57,7 @@ pub trait DataSource {
|
|||
&self,
|
||||
champ: &ChampInfo,
|
||||
positions: &[String],
|
||||
path: &PathBuf,
|
||||
path: &Path,
|
||||
client: &ureq::Agent,
|
||||
) {
|
||||
info!(
|
||||
|
|
|
@ -115,10 +115,7 @@ fn get_auth_token() -> Option<String> {
|
|||
None => return None,
|
||||
};
|
||||
bundle = (&bundle[(q_position + 1)..]).to_string();
|
||||
match bundle.find('"') {
|
||||
Some(position) => Some((&bundle[..position]).to_string()),
|
||||
None => None,
|
||||
}
|
||||
bundle.find('"').map(|position| (&bundle[..position]).to_string())
|
||||
}
|
||||
|
||||
impl KBDataSource {
|
||||
|
|
|
@ -11,7 +11,7 @@ use std::io;
|
|||
use std::io::Error;
|
||||
#[cfg(target_os = "windows")]
|
||||
use std::io::ErrorKind;
|
||||
use std::path::PathBuf;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::time::Instant;
|
||||
use std::{fs, thread, time};
|
||||
use time::Duration;
|
||||
|
@ -128,7 +128,7 @@ fn execute_data_source(
|
|||
data_source: &(dyn DataSource + Sync + Send),
|
||||
client: &ureq::Agent,
|
||||
champion: &Champion,
|
||||
lol_champs_dir: &PathBuf,
|
||||
lol_champs_dir: &Path,
|
||||
) {
|
||||
let champs = data_source.get_champs_with_positions(&client, &champion);
|
||||
|
||||
|
@ -168,7 +168,7 @@ fn get_and_write_item_set(
|
|||
data_source: &(dyn DataSource + Sync + Send),
|
||||
client: &ureq::Agent,
|
||||
champion: &Champion,
|
||||
lol_champs_dir: &PathBuf,
|
||||
lol_champs_dir: &Path,
|
||||
id: u32,
|
||||
positions: &[String],
|
||||
) {
|
||||
|
|
|
@ -36,9 +36,9 @@ impl DataSource for MSDataSource {
|
|||
let role =
|
||||
&page[p + page[p..].find('/').unwrap() + 1..p + page[p..].find('"').unwrap()];
|
||||
|
||||
let k = p + &page[p..].find("data-search-terms-like=\"").unwrap() + 24;
|
||||
let pipe = k + &page[k..].find("|").unwrap() + 1;
|
||||
let key = &page[pipe..pipe + &page[pipe..].find('"').unwrap()];
|
||||
let k = p + page[p..].find("data-search-terms-like=\"").unwrap() + 24;
|
||||
let pipe = k + page[k..].find('|').unwrap() + 1;
|
||||
let key = &page[pipe..pipe + page[pipe..].find('"').unwrap()];
|
||||
|
||||
let id = champion.data.get(key).unwrap().key.parse::<u32>().unwrap();
|
||||
|
||||
|
@ -82,7 +82,7 @@ impl DataSource for MSDataSource {
|
|||
let mut pos: Option<usize> = page.find("/item/");
|
||||
while let Some(mut p) = pos {
|
||||
p += 6;
|
||||
let i = &page[p..p + &page[p..].find('.').unwrap()];
|
||||
let i = &page[p..p + page[p..].find('.').unwrap()];
|
||||
|
||||
items.push(i);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue