diff --git a/fuzzy-pokedex b/fuzzy-pokedex index ee2a9ba..9eb17b9 100755 --- a/fuzzy-pokedex +++ b/fuzzy-pokedex @@ -13,8 +13,9 @@ help() { ### Pokedex viewer using pokemon-colorscripts and fzf fuzzy_pokedex() { - pokemon-colorscripts -l | - fzf +m -s -i \ + POKEDATA="/home/ez/Git/fuzzy-pokedex/pokeData/" + pokemon-colorscripts -l | sort | + fzf -q "$1" +m -s -i \ --cycle \ --reverse \ --prompt=' ' \ @@ -27,20 +28,22 @@ fuzzy_pokedex() { --info=inline:' 󰨉 ' \ --color='fg+:15,fg:42,preview-fg:15,label:9,preview-label:15,hl+:134,hl:123,query:134,gutter:0,border:9,prompt:15,pointer:15,marker:15' \ --tiebreak=begin,chunk,length \ - --preview="echo; pokemon-colorscripts -n {1} --no-title; cat /home/ez/Git/fuzzy-pokedex/pokeData/{1}" \ + --preview="echo; pokemon-colorscripts -n {1} --no-title; cat $POKEDATA{1}" \ --preview-window=68%:wrap:border-rounded \ --bind=focus:transform-preview-label:'echo [ {1} ] ' \ - --bind=ctrl-h:preview:'echo; ./fuzzy-pokedex -h;' \ - --bind=ctrl-b:preview:'echo; pokemon-colorscripts -b -n {1} --no-title; cat /home/ez/Git/fuzzy-pokedex/pokeData/{1};' \ - --bind=ctrl-s:preview:'echo; pokemon-colorscripts -s -n {1} --no-title; cat /home/ez/Git/fuzzy-pokedex/pokeData/{1};' \ - --bind=ctrl-n:preview:'echo; pokemon-colorscripts -n {1} --no-title; cat /home/ez/Git/fuzzy-pokedex/pokeData/{1};' | - parallel pokemon-colorscripts --no-title -n {} "&&" cat /home/ez/Git/fuzzy-pokedex/pokeData/{} + --bind=ctrl-h:preview:"echo; ./fuzzy-pokedex -h;" \ + --bind=ctrl-b:preview:"echo; pokemon-colorscripts -b -n {1} --no-title; cat $POKEDATA{1};" \ + --bind=ctrl-s:preview:"echo; pokemon-colorscripts -s -n {1} --no-title; cat $POKEDATA{1};" \ + --bind=ctrl-n:preview:"echo; pokemon-colorscripts -n {1} --no-title; cat $POKEDATA{1};" | + parallel pokemon-colorscripts --no-title -n {} "&&" cat "$POKEDATA"{} } ### Update Pokemon stats file set update_pokeData() { + POKEINFO="/home/ez/Git/fuzzy-pokedex/pokeinfo" + POKEDATA="/home/ez/Git/fuzzy-pokedex/pokeData/" echo -e "\n\t\tWARNING!!!\n\tThis WILL take a long time\n" - pokemon-colorscripts -l | sort | parallel --bar --color -j 200% /home/ez/Git/fuzzy-pokedex/pokeinfo {} ">" /home/ez/Git/pokedex/pokeData/{} + pokemon-colorscripts -l | sort | parallel --bar --color --retry-failed -j 200% "$POKEINFO" {} ">" "$POKEDATA"{} } if [[ ! "$1" =~ ^- ]]; then diff --git a/pokeData/drampa b/pokeData/drampa index 2f7690a..e69de29 100644 --- a/pokeData/drampa +++ b/pokeData/drampa @@ -1,15 +0,0 @@ - -Name: Drampa -Pokedex Number: 780 -Gender Ratio:  ♂:50.2% ♀:49.8% -Abilities: Berserk - Sap Sipper - Cloud Nine (Hidden Ability) - -Base Stats ----------------------- -Total: 485 -Hp: 78 -Attack: 60 -Defence: 85 -Special Attack: 135 -Special Defence: 91 -Speed: 36 diff --git a/pokeData/necrozma b/pokeData/necrozma index e5fe139..e69de29 100644 --- a/pokeData/necrozma +++ b/pokeData/necrozma @@ -1,15 +0,0 @@ - -Name: Necrozma -Pokedex Number: 800 -Gender Ratio: Genderless -Abilities: Prism Armor - -Base Stats ----------------------- -Total: 600 -Hp: 97 -Attack: 113 -Defence: 109 -Special Attack: 157 -Special Defence: 127 -Speed: 77 diff --git a/pokeData/nidoran-m b/pokeData/nidoran-m index c8f722b..e69de29 100644 --- a/pokeData/nidoran-m +++ b/pokeData/nidoran-m @@ -1,15 +0,0 @@ - -Name: Nidoran-M -Pokedex Number: 032 -Gender Ratio:  ♂:100% ♀:0% -Abilities: Poison Point - Rivalry - Hustle (Hidden Ability) - -Base Stats ----------------------- -Total: 273 -Hp: 46 -Attack: 57 -Defence: 40 -Special Attack: 40 -Special Defence: 40 -Speed: 50 diff --git a/pokeData/popplio b/pokeData/popplio index 8713cc1..e69de29 100644 --- a/pokeData/popplio +++ b/pokeData/popplio @@ -1,15 +0,0 @@ - -Name: Popplio -Pokedex Number: 728 -Gender Ratio:  ♂:88.14% ♀:11.86% -Abilities: Torrent - Liquid Voice (Hidden Ability) - -Base Stats ----------------------- -Total: 320 -Hp: 50 -Attack: 54 -Defence: 54 -Special Attack: 66 -Special Defence: 56 -Speed: 40 diff --git a/pokeData/porygon2 b/pokeData/porygon2 index 069cf6d..e69de29 100644 --- a/pokeData/porygon2 +++ b/pokeData/porygon2 @@ -1 +0,0 @@ - Stats currently unavailable :( diff --git a/pokeinfo b/pokeinfo index a39d2c3..f420970 100755 --- a/pokeinfo +++ b/pokeinfo @@ -32,15 +32,19 @@ begin_url = ["http://serebii.net/pokedex-xy/", "http://serebii.net/pokedex-rs/", "http://serebii.net/pokedex-gs/", "http://serebii.net/pokedex/"] + for i in begin_url: - request1 = requests.get(i) - html1 = request1.content - soup1 = BeautifulSoup(html1, "html.parser") - page_info1 = soup1.get_text() + try: + request1 = requests.get(i) + except OSError: + sys.exit(1) + html1 = request1.content + soup1 = BeautifulSoup(html1, "html.parser") + page_info1 = soup1.get_text() # Pokedex Entries Start At Index 5000 - pokemon_index = page_info1.find(pokemon, 5000) - if pokemon_index != -1: - break + pokemon_index = page_info1.find(pokemon, 5000) + if pokemon_index != -1: + break if pokemon_index == -1: print("You didn't enter a valid pokemon!") @@ -58,9 +62,11 @@ for i in begin_url: page_not_found = bool(soup2.find(string=re.compile("Page Not Found"))) if page_not_found == False: break + if page_not_found: print(" Stats currently unavailable :( ") - + sys.exit(1) + ######## Get Stats ######## base_total = soup2.find(string=re.compile("Base Stats - Total:")) # Only want everything after Total