mirror of
https://github.com/ksyasuda/aniwrapper.git
synced 2024-10-28 04:44:11 -07:00
docs: added comments
This commit is contained in:
parent
59416e4ef3
commit
4a77126a7c
17
ani-cli
17
ani-cli
@ -1,6 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# dependencies: sed curl
|
# dependencies: sed curl mpv
|
||||||
|
|
||||||
prog="ani-cli"
|
prog="ani-cli"
|
||||||
|
|
||||||
@ -101,8 +101,9 @@ menu_format_string_c2="$c_blue[$c_cyan%d$c_blue] $c_yellow%s$c_reset\n"
|
|||||||
|
|
||||||
count=1
|
count=1
|
||||||
while read anime_id; do
|
while read anime_id; do
|
||||||
[ $((count % 2)) -eq 0 ] &&
|
# alternating colors for menu
|
||||||
menu_format_string=$menu_format_string_c1 ||
|
[ $((count % 2)) -eq 0 ] &&
|
||||||
|
menu_format_string=$menu_format_string_c1 ||
|
||||||
menu_format_string=$menu_format_string_c2
|
menu_format_string=$menu_format_string_c2
|
||||||
|
|
||||||
printf "$menu_format_string" "$count" "$anime_id"
|
printf "$menu_format_string" "$count" "$anime_id"
|
||||||
@ -111,12 +112,15 @@ done <<EOF
|
|||||||
$search_results
|
$search_results
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
# User input
|
||||||
printf "$c_blue%s$c_green" "Enter number: "
|
printf "$c_blue%s$c_green" "Enter number: "
|
||||||
read choice
|
read choice
|
||||||
printf "$c_reset"
|
printf "$c_reset"
|
||||||
|
|
||||||
|
# Check if input is a number
|
||||||
[ "$choice" -eq "$choice" ] 2>/dev/null || die "Invalid number entered"
|
[ "$choice" -eq "$choice" ] 2>/dev/null || die "Invalid number entered"
|
||||||
|
|
||||||
|
# Select respective anime_id
|
||||||
count=1
|
count=1
|
||||||
while read anime_id; do
|
while read anime_id; do
|
||||||
if [ $count -eq $choice ]; then
|
if [ $count -eq $choice ]; then
|
||||||
@ -156,6 +160,7 @@ while :; do
|
|||||||
|
|
||||||
case $video_url in
|
case $video_url in
|
||||||
*streamtape*)
|
*streamtape*)
|
||||||
|
# If direct download not available then scrape streamtape.com
|
||||||
BROWSER=${BROWSER:-firefox}
|
BROWSER=${BROWSER:-firefox}
|
||||||
printf "scraping streamtape.com\n"
|
printf "scraping streamtape.com\n"
|
||||||
video_url=$(curl -s "$video_url" | sed -n -E '
|
video_url=$(curl -s "$video_url" | sed -n -E '
|
||||||
@ -172,11 +177,11 @@ while :; do
|
|||||||
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"
|
||||||
printf "${c_blue}Enter choice:${c_green} "
|
printf "${c_blue}Enter choice:${c_green} "
|
||||||
read choice
|
read choice
|
||||||
printf "$c_reset"
|
printf "$c_reset"
|
||||||
case $choice in
|
case $choice in
|
||||||
n)
|
n)
|
||||||
ep_choice=$((ep_choice+1))
|
ep_choice=$((ep_choice+1))
|
||||||
;;
|
;;
|
||||||
p)
|
p)
|
||||||
|
Loading…
Reference in New Issue
Block a user