Switch to PokeAPI #1

Merged
ericlay merged 20 commits from dev into main 2023-04-24 19:05:08 -05:00
2 changed files with 13 additions and 9 deletions
Showing only changes of commit 5580150e0b - Show all commits

View File

@ -8,8 +8,9 @@ COUNT="$WC"
for POKEMON in $(pokemon-colorscripts -l); do
./jqPoke "$POKEMON" > "./pokeData/$POKEMON"
((COUNT++))
PCT="$((WC*100/COUNT))"
printf "%s \t%s%%\n" "$POKEMON" "$PCT"
((COUNT--))
PCTLEFT="$((COUNT*100/WC))"
PCTDONE="$((100-PCTLEFT))"
printf "\t%s - %s \t%s%%\n" "$COUNT" "$POKEMON" "$PCTDONE"
done

View File

@ -4,6 +4,7 @@
shopt -s extglob
KBINDS="/usr/share/fuzzy-pokedex-dev/keybindings-preview"
POKEDATA="/usr/share/fuzzy-pokedex-dev/pokeData"
indent="\n\t\t\t\t\t"
### Help
help() {
@ -11,7 +12,9 @@ help() {
printf "%s\n\t%s\n\n" "EXAMPLE" "pokedex [pokemon name]"
printf "%s\n" "OPTIONS"
printf "%-25s\t%s\n" " -q, --quick [pokemon]" "Prints single pokedex entry to terminal" \
" -u, --update [N/+N/-N/N%]" "Scrape web for updated Pokemon stats" "" " WARNING: update function is resource heavy" "" " See Parallel job control (-j) for options" "" " Default is 200%" \
" -u, --update [N/+N/-N/N%]" "Scrape web for updated Pokemon stats" "" \
" WARNING: update function is resource heavy" "" " See Parallel job control (-j) for options" "" \
" Default is 200%" \
" -h, --help" "Print this help screen"
printf "\n%s\n" "KEYBINDS"
printf "%-15s\t%s\n" " space" "Reads the Pokedex entry" \
@ -39,15 +42,15 @@ 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="printf '\n\t\t\t\t\t%s\n\t\t\t\t\t %s\n' 'Press space to hear entry' 'ctrl+space to stop'; pokemon-colorscripts -n {1} --no-title; cat $POKEDATA/{1}" \
--preview="printf '${indent}%s${indent} %s\n' 'Press space to hear entry' 'ctrl+space to stop'; 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:"cat $KBINDS" \
--bind=space:preview:"printf '\n\t\t\t\t %s\n\t\t\t\t\t %s\n' 'Select another Pokemon to stop audio' 'Or press ctrl+space'; pokemon-colorscripts -n {1} --no-title; cat $POKEDATA/{1}; espeak-ng -f $POKEDATA/{1} -g 4 -p 50 -s 145 -l 250 -ven+m3 &" \
--bind=ctrl-space:preview:"printf '\n\t\t\t\t\t%s\n\t\t\t\t\t %s\n' 'Press space to hear entry' 'ctrl+space to stop'; pokemon-colorscripts -n {1} --no-title; cat $POKEDATA/{1};" \
--bind=space:preview:"printf '${indent::-2} %s${indent} %s\n' 'Select another Pokemon to stop audio' 'Or press ctrl+space'; pokemon-colorscripts -n {1} --no-title; cat $POKEDATA/{1}; espeak-ng -f $POKEDATA/{1} -g 4 -p 50 -s 145 -l 250 -ven+m3 &" \
--bind=ctrl-space:preview:"printf '${indent}%s${indent} %s\n' 'Press space to hear entry' 'ctrl+space to stop'; pokemon-colorscripts -n {1} --no-title; cat $POKEDATA/{1};" \
--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:"printf '\n\t\t\t\t\t%s\n\t\t\t\t\t %s\n' 'Press space to hear entry' 'ctrl+space to stop'; pokemon-colorscripts -n {1} --no-title; cat $POKEDATA/{1};" |
--bind=ctrl-n:preview:"printf '${indent}%s${indent} %s\n' 'Press space to hear entry' 'ctrl+space to stop'; pokemon-colorscripts -n {1} --no-title; cat $POKEDATA/{1};" |
parallel pokemon-colorscripts --no-title -n {} "&&" cat "$POKEDATA/{}"
}
@ -59,7 +62,7 @@ quick_view() {
### Update Pokemon stats file set
update_pokeData() {
printf "\n\t\t%s\n\t%s\n\n" "WARNING!!!" "This WILL take a long time"
pokemon-colorscripts -l | sort | parallel --progress --bar --color --retry-failed -j "${1:-200%}" pokeInfo {} ">" "$POKEDATA/{}" 2>&1
./jqPokeTest
}
if ! (( $# )); then