docs: added comments

This commit is contained in:
Harshith 2021-06-10 03:19:28 +05:30
parent 59416e4ef3
commit 4a77126a7c

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# dependencies: sed curl # dependencies: sed curl mpv
prog="ani-cli" prog="ani-cli"
@ -101,6 +101,7 @@ 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
# alternating colors for menu
[ $((count % 2)) -eq 0 ] && [ $((count % 2)) -eq 0 ] &&
menu_format_string=$menu_format_string_c1 || menu_format_string=$menu_format_string_c1 ||
menu_format_string=$menu_format_string_c2 menu_format_string=$menu_format_string_c2
@ -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 '