youtube-tui

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.concealed.world/youtube-tui
Log | Files | Refs | README | LICENSE

commit 68f678270693fc5acb102b7b9ba47fbbdd44a1ed
parent c2ccb444b67c7b7cdd24fdceb6772a1e6b5d7bf1
Author: Nixx <nixx@firemail.cc>
Date:   Sat, 24 Oct 2020 15:21:51 +0100

More error checking.

Diffstat:
Mytsearch | 16+++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/ytsearch b/ytsearch @@ -1,5 +1,5 @@ #!/bin/sh -# Last Revision: Tue 20 Oct 13:30:24 BST 2020 +# Last Revision: Sat 24 Oct 15:20:35 BST 2020 # A messy bash TUI client for YT/Invidious. # DEPENDS: youtube-dl, mpv, ffmpeg, xclip, coreutils # @@ -328,8 +328,7 @@ if [[ $confirm == 'D' || $confirm == 'd' || $confirm == 'download' || $confirm = youtube-dl -i -f "${vformat}" "https://www.youtube.com/${fullurl}" ((playmatchcount++)) done - fi - if [[ $vid == 'a' || $vid == 'A' || $vid == 'audio' || $vid == 'Audio' ]]; then + elif [[ $vid == 'a' || $vid == 'A' || $vid == 'audio' || $vid == 'Audio' ]]; then if [[ $count == 0 && -n $url ]]; then printf '\n' copy "${website}${url}" @@ -348,6 +347,8 @@ if [[ $confirm == 'D' || $confirm == 'd' || $confirm == 'download' || $confirm = youtube-dl -ix --audio-format "mp3" "https://www.youtube.com/${fullurl}" ((playmatchcount++)) done + else + printf "\e[1;91mERROR: Invalid action.\e[0m\n" && exit 1 fi elif [[ $confirm == 'S' || $confirm == 's' || $confirm == 'stream' || $confirm == 'Stream' ]]; then read -p '(e)xit | (v)ideo or (a)udio only?: ' vid @@ -371,8 +372,7 @@ elif [[ $confirm == 'S' || $confirm == 's' || $confirm == 'stream' || $confirm = mpv --ytdl-format="${vformat}" --ytdl "https://www.youtube.com/${fullurl}" ((playmatchcount++)) done - fi - if [[ $vid == 'a' || $vid == 'A' || $vid == 'audio' || $vid == 'Audio' ]]; then + elif [[ $vid == 'a' || $vid == 'A' || $vid == 'audio' || $vid == 'Audio' ]]; then if [[ $count == 0 && -n $url ]]; then printf '\n' copy "${website}${url}" @@ -391,6 +391,8 @@ elif [[ $confirm == 'S' || $confirm == 's' || $confirm == 'stream' || $confirm = mpv --ytdl-format=bestaudio --no-video --ytdl "https://www.youtube.com/${fullurl}" ((playmatchcount++)) done + else + printf "\e[1;91mERROR: Invalid action.\e[0m\n" && exit 1 fi elif [[ $confirm == 'u' || $confirm == 'U' ]]; then read -p '(e)xit | Print to std(o)ut, or to (f)ile?: ' stdf @@ -432,10 +434,10 @@ elif [[ $confirm == 'u' || $confirm == 'U' ]]; then ((playmatchcount++)) done else - printf "\e[1;91mERROR: Invalid action.\e[0m\n" && exit 0 + printf "\e[1;91mERROR: Invalid action.\e[0m\n" && exit 1 fi else - printf "\e[1;91mERROR: Invalid action.\e[0m\n" && exit 0 + printf "\e[1;91mERROR: Invalid action.\e[0m\n" && exit 1 fi }