Browse Source

- More small improvments to the parser

master
Quildra 1 year ago
parent
commit
6ea4c4b52f
  1. 16
      Utilities/DetermineOriginGame.py
  2. 4
      pokemon_home_list.csv

16
Utilities/DetermineOriginGame.py

@ -348,7 +348,7 @@ def get_locations_from_bulbapedia(pokemon_name, form, cache):
variant = ""
for sibling in event_header.find_next_siblings():
if sibling.name == 'h4':
if sibling.name == 'h4' or "held" in sibling.getText(strip=True).lower():
break
if sibling.name == 'h5':
variant = sibling.get_text(strip=True)
@ -376,7 +376,7 @@ def get_locations_from_bulbapedia(pokemon_name, form, cache):
# For Later
for variant in event_tables:
if variant == pokemon_name or (form and form in variant):
if (variant == pokemon_name and form is None)or (form and form in variant):
games_container_rows = event_tables[variant].find_all('tr')
for game_row in games_container_rows:
entries = game_row.find_all('td')
@ -384,7 +384,9 @@ def get_locations_from_bulbapedia(pokemon_name, form, cache):
games_string = entries[0].find('a').get('title')
for game in all_games:
if game in games_string:
game_locations[game] = "Event"
if game not in game_locations:
game_locations[game] = []
game_locations[game].append("Event")
return game_locations
@ -620,9 +622,9 @@ def check_alternative_sources(pokemon, cache):
if event_status:
return "Event", "Event"
bulb_locations = get_locations_from_bulbapedia(pokemon['base_name'], pokemon['form'], cache)
if bulb_locations:
return bulb_locations[0], "Bulbapedia"
#bulb_locations = get_locations_from_bulbapedia(pokemon['base_name'], pokemon['form'], cache)
#if bulb_locations:
# return bulb_locations[0], "Bulbapedia"
# Check generation introduced
#generation = species_data.get('generation', {}).get('name', '')
@ -649,7 +651,7 @@ def handle_unknown_encounters(pokemon_list, cache):
if __name__ == "__main__":
get_cached_data()
pokemon_list = read_pokemon_list('pokemon_home_list.csv', limit=151)
pokemon_list = read_pokemon_list('pokemon_home_list.csv', limit=3000)
pokemon_list_with_games = determine_earliest_games(pokemon_list, cache)
pokemon_list_adjusted = adjust_for_evolution(pokemon_list_with_games, cache)
pokemon_list_with_locations = add_encounter_locations(pokemon_list_adjusted, cache)

4
pokemon_home_list.csv

@ -40,10 +40,10 @@ number,name
0027,Sandshrew (Alolan Form)
0028,Sandslash
0028,Sandslash (Alolan Form)
0029,Nidoran-f
0029,Nidoran
0030,Nidorina
0031,Nidoqueen
0032,Nidoran-m
0032,Nidoran
0033,Nidorino
0034,Nidoking
0035,Clefairy

1 number name
40 0027 Sandshrew (Alolan Form)
41 0028 Sandslash
42 0028 Sandslash (Alolan Form)
43 0029 Nidoran-f Nidoran♀
44 0030 Nidorina
45 0031 Nidoqueen
46 0032 Nidoran-m Nidoran♂
47 0033 Nidorino
48 0034 Nidoking
49 0035 Clefairy
Loading…
Cancel
Save