diff --git a/src/data/corebundle/mod.rs b/src/data/corebundle/mod.rs index a95aa05..8957087 100644 --- a/src/data/corebundle/mod.rs +++ b/src/data/corebundle/mod.rs @@ -83,9 +83,13 @@ pub fn create_globalindexes_from_wd() -> globals::LocalizedGlobalsIndexes { pub async fn create_globalindexes_from_dd_latest_en_us() -> globals::LocalizedGlobalsIndexes { let client = reqwest::Client::new(); + log::debug!("Fetching latest CoreBundle from Data Dragon..."); + let core = CoreBundle::fetch(&client, "https://dd.b.pvp.net/latest", "en_us").await .expect("to be able to fetch `core-en_us` bundle"); + log::debug!("Fetched latest CoreBundle: it defines {} regions, {} keywords, {} rarities, {} sets, {} spell speeds, and {} vocab terms!", &core.globals.regions.len(), &core.globals.keywords.len(), &core.globals.rarities.len(), &core.globals.sets.len(), &core.globals.spell_speeds.len(), &core.globals.vocab_terms.len()); + globals::LocalizedGlobalsIndexes::from(core.globals) } diff --git a/src/data/setbundle/mod.rs b/src/data/setbundle/mod.rs index 6a0abdb..ab22081 100644 --- a/src/data/setbundle/mod.rs +++ b/src/data/setbundle/mod.rs @@ -168,8 +168,13 @@ pub async fn create_cardindex_from_dd_latest_en_us() -> card::CardIndex { let mut index = card::CardIndex::new(); for set_code in DD_KNOWN_SET_CODES { + log::debug!("Fetching SetBundle with code {} from Data Dragon...", &set_code); + let set = SetBundle::fetch(&client, "https://dd.b.pvp.net/latest", "en_us", set_code).await .expect("to be able to fetch set bundle"); + + log::debug!("Fetched SetBundle with code {}: it defines {} cards!", &set_code, set.cards.len()); + for card in set.cards { index.insert(card.code.clone(), card); }