fix getting query from search history or input

This commit is contained in:
ksyasuda 2021-11-04 19:45:17 -07:00
parent a5033db481
commit cc9a0a870f
2 changed files with 24 additions and 6 deletions

14
ani-cli
View File

@ -207,10 +207,11 @@ get_search_query() {
query=$(printf "%s\n" "${hist[@]}" | query=$(printf "%s\n" "${hist[@]}" |
rofi -dmenu -l 12 -p "Search Anime:" \ rofi -dmenu -l 12 -p "Search Anime:" \
-mesg "$span" \ -mesg "$span" \
-config "$CFG_DIR/${ROFI_CFG}" | awk '{print $NF}') -config "$CFG_DIR/${ROFI_CFG}")
# Strip the list entry number from string
query="${query//[1-9]\. /}"
[ "$VERBOSE" -eq 1 ] && printf "%s\n" "Query: $query" [ "$VERBOSE" -eq 1 ] && printf "%s\n" "Query: $query"
# printf "Search Anime: "
# read -r query
else else
query=$* query=$*
fi fi
@ -470,7 +471,7 @@ is_playlist=0
playlist_remove=0 playlist_remove=0
playlist_add=0 playlist_add=0
playlist_file="$CFG_DIR/playlists/playlist.txt" playlist_file="$CFG_DIR/playlists/playlist.txt"
while getopts 'hd:Hlpad' OPT; do while getopts 'hd:HlpadP:' OPT; do
case $OPT in case $OPT in
h) h)
help_text help_text
@ -502,6 +503,11 @@ while getopts 'hd:Hlpad' OPT; do
is_delete=1 is_delete=1
scrape=delete scrape=delete
;; ;;
P)
is_playlist=1
playlist_file="$OPTARG"
[ -z "$playlist_file" ] && die "Eneter in path to playlist"
mpv "$playlist_file"
esac esac
done done
shift $((OPTIND - 1)) shift $((OPTIND - 1))

View File

@ -14,7 +14,7 @@ CFG_FILE="meh.rasi"
options="1. Stream|2. Download|3. Continue|4. Queue|5. Quit" options="1. Stream|2. Download|3. Continue|4. Queue|5. Quit"
choice=$(echo "${options[@]}" | rofi -dmenu -sep '|' -config "$CFG_DIR/$CFG_FILE" -l 4 -i -p "Enter choice:") choice=$(echo "${options[@]}" | rofi -dmenu -sep '|' -config "$CFG_DIR/$CFG_FILE" -l 5 -i -p "Enter choice:")
[ "$choice" == "5. Quit" ] && ( [ "$choice" == "5. Quit" ] && (
echo 'Quitting...' echo 'Quitting...'
@ -43,7 +43,19 @@ elif [[ "$selection" == "4." ]]; then
) )
selection=$(printf "%s\n" "$choice" | awk '{ print $1 }') selection=$(printf "%s\n" "$choice" | awk '{ print $1 }')
if [[ "$selection" == "1." ]]; then if [[ "$selection" == "1." ]]; then
"$CMD" -p options="1. Streaming|2. From file|3. Quit"
choice=$(echo "${options[@]}" | rofi -dmenu -sep '|' -config "$CFG_DIR/$CFG_FILE" -l 4 -i -p "Enter choice:")
[ "$choice" == "4. Quit" ] && (
echo 'Quitting...'
exit 0
)
selection=$(printf "%s\n" "$choice" | awk '{ print $1 }')
if [[ "$selection" == "1." ]]; then
"$CMD" -p
elif [[ "$selection" == "2." ]]; then
"$CMD" -P
fi
# selection=$(printf "%s\n" "$choice" | awk '{ print $1 }')
elif [[ "$selection" == "2." ]]; then elif [[ "$selection" == "2." ]]; then
"$CMD" -a "$CMD" -a
elif [[ "$selection" == "3." ]]; then elif [[ "$selection" == "3." ]]; then