mirror of
https://github.com/ksyasuda/aniwrapper.git
synced 2024-10-28 04:44:11 -07:00
update process to selectively bypass anime selection
bypass anime selection menu when selecting an anime from the search history list. When supplying a new search query, the regular anime selection process is run
This commit is contained in:
parent
7b03f71130
commit
ef5e8b6ec3
24
ani-cli
24
ani-cli
@ -60,10 +60,12 @@ search_anime() {
|
|||||||
# get anime name along with its id
|
# get anime name along with its id
|
||||||
log "NUM ARGS: $#"
|
log "NUM ARGS: $#"
|
||||||
if [[ $# -gt 1 ]]; then
|
if [[ $# -gt 1 ]]; then
|
||||||
|
# if multi-word query, concatenate into one string and replace spaces with '-'
|
||||||
search="$*"
|
search="$*"
|
||||||
search="${search// /-}"
|
search="${search// /-}"
|
||||||
else
|
else
|
||||||
search="$1"
|
# if one word, remove leading or trailing whitespace
|
||||||
|
search="${1// /}"
|
||||||
fi
|
fi
|
||||||
# search=${1// /-}
|
# search=${1// /-}
|
||||||
log "Search Query: $search"
|
log "Search Query: $search"
|
||||||
@ -635,12 +637,28 @@ shift $((OPTIND - 1))
|
|||||||
case $scrape in
|
case $scrape in
|
||||||
query)
|
query)
|
||||||
get_search_query "$*"
|
get_search_query "$*"
|
||||||
res=$(check_db "$query" search)
|
searched=0
|
||||||
log "Searched before: $res"
|
if [ $# -eq 1 ]; then
|
||||||
|
# check if anime has been searched before
|
||||||
|
anime_id="${query// /}"
|
||||||
|
log "Checking if anime: $anime_id has been searched before..."
|
||||||
|
check_db "$anime_id" "search"
|
||||||
|
searched="$?"
|
||||||
|
log "Searched before: $searched"
|
||||||
|
fi
|
||||||
|
if [ "$searched" -eq 0 ]; then
|
||||||
search_results=$(search_anime $query)
|
search_results=$(search_anime $query)
|
||||||
[ -z "$search_results" ] && die "No search results found"
|
[ -z "$search_results" ] && die "No search results found"
|
||||||
if ! anime_selection "$search_results"; then
|
if ! anime_selection "$search_results"; then
|
||||||
die "No anime selection found"
|
die "No anime selection found"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# if the query is a previous search
|
||||||
|
# skip search_anime function and assign $query
|
||||||
|
anime_id="${query// /}"
|
||||||
|
selection_id="$anime_id"
|
||||||
|
insert_history "$anime_id" "search"
|
||||||
|
read -r last_ep_number <<< "$(search_eps "$selection_id")"
|
||||||
fi
|
fi
|
||||||
episode_selection
|
episode_selection
|
||||||
;;
|
;;
|
||||||
|
Loading…
Reference in New Issue
Block a user