mirror of
https://github.com/ksyasuda/aniwrapper.git
synced 2024-11-22 03:19:53 -08: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
34
ani-cli
34
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,13 +637,29 @@ 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
|
||||||
search_results=$(search_anime $query)
|
# check if anime has been searched before
|
||||||
[ -z "$search_results" ] && die "No search results found"
|
anime_id="${query// /}"
|
||||||
if ! anime_selection "$search_results"; then
|
log "Checking if anime: $anime_id has been searched before..."
|
||||||
die "No anime selection found"
|
check_db "$anime_id" "search"
|
||||||
fi
|
searched="$?"
|
||||||
|
log "Searched before: $searched"
|
||||||
|
fi
|
||||||
|
if [ "$searched" -eq 0 ]; then
|
||||||
|
search_results=$(search_anime $query)
|
||||||
|
[ -z "$search_results" ] && die "No search results found"
|
||||||
|
if ! anime_selection "$search_results"; then
|
||||||
|
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
|
||||||
episode_selection
|
episode_selection
|
||||||
;;
|
;;
|
||||||
history)
|
history)
|
||||||
|
Loading…
Reference in New Issue
Block a user