fix multiword searches from menu (#11)

This commit is contained in:
Kyle Yasuda 2022-07-11 12:30:27 -07:00 committed by GitHub
parent 1c8afc16cc
commit fa108d860f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 2 deletions

View File

@ -415,7 +415,7 @@ stream() {
else
get_search_query "$*"
fi
anime_id="${query// /}"
anime_id="$query"
[ -z "$anime_id" ] && die "No anime selected or queried"
searched=0
lg "Checking if anime: $anime_id has been searched before..."

View File

@ -128,6 +128,7 @@ get_search_query() {
else
prompt "Search Anime"
read -r query
query="${query// /-}"
fi
}

View File

@ -173,7 +173,8 @@ get_search_query() {
query=$(rofi -dpi "$DPI" -dmenu -l 15 -p "Search Anime:" \
-mesg "$(generate_span "$msg")" \
-config "$ROFI_CFG" -window-title 'aniwrapper' < <(run_stmt "$stmt"))
query="${query//[1-9]*\. /}"
query="${query#*\. }" # remove [1-9]. from beginning of query
query="${query// /-}" # replace spaces with -
fi
}