fix: episodes repeating

This commit is contained in:
Harshith 2021-06-13 17:24:19 +05:30
parent 9792a65144
commit 013048b4cd

24
ani-cli
View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# dependencies: sed curl mpv/vlc # dependencies: sed curl video_player
# player used to play videos ( needs to be able to play urls ) # video_player ( needs to be able to play urls )
player_fn="mpv" player_fn="mpv"
prog="ani-cli" prog="ani-cli"
@ -229,18 +229,18 @@ open_episode () {
fi fi
} }
while :; do
# to donwload/view many episodes at a time
for ep in $episodes for ep in $episodes
do do
open_episode "$selection_id" "$ep" open_episode "$selection_id" "$ep"
done done
# set episodes to the last episode and continue with menu episode=${ep_choice_end:-$ep_choice_start}
episodes=${ep_choice_end:-$ep_choice_start}
printf "\n${c_green}Currently playing %s episode ${c_cyan}%d/%d\n" "$selection_id" $ep_choice $last_ep_number while :; do
# to donwload/view many episodes at a time
# set episodes to the last episode and continue with menu, only the first time
printf "\n${c_green}Currently playing %s episode ${c_cyan}%d/%d\n" "$selection_id" $episode $last_ep_number
printf "$c_blue[${c_cyan}%s$c_blue] $c_yellow%s$c_reset\n" "n" "next episode" printf "$c_blue[${c_cyan}%s$c_blue] $c_yellow%s$c_reset\n" "n" "next episode"
printf "$c_blue[${c_cyan}%s$c_blue] $c_magenta%s$c_reset\n" "p" "previous episode" printf "$c_blue[${c_cyan}%s$c_blue] $c_magenta%s$c_reset\n" "p" "previous episode"
printf "$c_blue[${c_cyan}%s$c_blue] $c_red%s$c_reset\n" "q" "exit" printf "$c_blue[${c_cyan}%s$c_blue] $c_red%s$c_reset\n" "q" "exit"
@ -249,10 +249,10 @@ while :; do
printf "$c_reset" printf "$c_reset"
case $choice in case $choice in
n) n)
episodes=$((episodes + 1)) episode=$((episode + 1))
;; ;;
p) p)
episodes=$((episodes - 1)) episode=$((episode - 1))
;; ;;
q) q)
break;; break;;
@ -260,4 +260,6 @@ while :; do
die "invalid choice" die "invalid choice"
;; ;;
esac esac
open_episode "$selection_id" "$episode"
done done