Added skip prompt option

This commit is contained in:
Jaidyn Ann 2017-01-07 12:26:35 -06:00
parent 33a564ed79
commit 180b61adce

View File

@ -1,7 +1,6 @@
#!/bin/sh #!/bin/sh
##################### #####################
# Name: yt-download.sh # Name: yt-down
# Date: 2016-12-10
# Lisc: GPLv2 # Lisc: GPLv2
# Auth: iluaster # Auth: iluaster
# Main: jadedctrl # Main: jadedctrl
@ -9,12 +8,26 @@
##################### #####################
# Based on https://github.com/iluaster/Youtube_downloader # Based on https://github.com/iluaster/Youtube_downloader
# Usage: yt-download.sh $video_id
# Usage: yt-down -[sSD] $video_id
# -s for stream; -S for stream and skip prompt;
# -D for download and skip prompt; No arg for download.
if [ "$1" = "-s" ] if [ "$1" = "-s" ]
then then
stream_mode=1 stream_mode=1
id=$2 id=$2
elif [ "$1" = "-S" ]
then
stream_mode=1
skip_prompt=1
id=$2
elif [ "$1" = "-D" ]
then
stream_mode=0
skip_prompt=1
id=$2
else else
stream_mode=0 stream_mode=0
id=$1 id=$1
@ -63,9 +76,14 @@ select_option ()
# Replace this pipe method so $line isn't lost # Replace this pipe method so $line isn't lost
echo "${line}. $i" echo "${line}. $i"
done done
if [ $skip_prompt -eq 0 ]
then
printf '\033[0;32m>>>\033[0m ' printf '\033[0;32m>>>\033[0m '
IFS='' IFS=''
read -r n read -r n
else
n=1
fi
if [ $n -le 5 ]; if [ $n -le 5 ];
then then