cleanup
This commit is contained in:
parent
6b5656ce8f
commit
3a9da2a22a
3 changed files with 114 additions and 106 deletions
17
README.org
17
README.org
|
|
@ -6,6 +6,8 @@
|
|||
Terminal YouTube (*tyt*) is a small bash script that lets you play YouTube videos by query from the command line.
|
||||
It is created via literate programming, you can find the code below.
|
||||
|
||||
[[./images/screenshot.png]]
|
||||
|
||||
** Script
|
||||
*** Dependencies
|
||||
|
||||
|
|
@ -204,11 +206,12 @@ If the interactive flag is present, show the first ten results and query for a v
|
|||
if [ "$interactive" = true ]
|
||||
then
|
||||
echo ""
|
||||
selections=(0 1 2 3 4 5 6 7 8 9)
|
||||
selections=(0 1 2 3 4 5 6 7 8 9 q)
|
||||
for i in ${selections[@]}
|
||||
do
|
||||
echo -ne " \e[1m$i\e[0m: ${titles[$i]} (\e[33m\e[1m${uploaders[$i]}\e[0m)\n"
|
||||
done
|
||||
echo -ne " \e[1mq\e[0m: Quit\n"
|
||||
echo -ne "\nSelection: "
|
||||
read selection
|
||||
while [[ ! "${selections[@]}" =~ "${selection}" ]]
|
||||
|
|
@ -216,6 +219,10 @@ If the interactive flag is present, show the first ten results and query for a v
|
|||
echo -ne "Not valid, try again: "
|
||||
read selection
|
||||
done
|
||||
if [ "$selection" = "q" ]
|
||||
then
|
||||
exit
|
||||
fi
|
||||
echo ""
|
||||
url=${urls[$selection]}
|
||||
title=${titles[$selection]}
|
||||
|
|
@ -249,11 +256,9 @@ In interaction mode, another video is queried to be played.
|
|||
|
||||
if [ "$interactive" = true ]
|
||||
then
|
||||
quit=false
|
||||
selections=(0 1 2 3 4 5 6 7 8 9 q)
|
||||
while [ ! "$quit" = true ]
|
||||
while :
|
||||
do
|
||||
echo -ne "\nSelect another or press [q] to quit: "
|
||||
echo -ne "\nSelect another or enter [q] to quit: "
|
||||
read selection
|
||||
while [[ ! "${selections[@]}" =~ "${selection}" ]]
|
||||
do
|
||||
|
|
@ -268,7 +273,7 @@ In interaction mode, another video is queried to be played.
|
|||
uploader=${uploaders[$selection]}
|
||||
play "$url" "$title" "$uploader"
|
||||
else
|
||||
quit=true
|
||||
exit
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
|
|
|||
BIN
images/screenshot.png
Normal file
BIN
images/screenshot.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 356 KiB |
15
tyt
15
tyt
|
|
@ -140,11 +140,12 @@ IFS=$OLDIFS
|
|||
if [ "$interactive" = true ]
|
||||
then
|
||||
echo ""
|
||||
selections=(0 1 2 3 4 5 6 7 8 9)
|
||||
selections=(0 1 2 3 4 5 6 7 8 9 q)
|
||||
for i in ${selections[@]}
|
||||
do
|
||||
echo -ne " \e[1m$i\e[0m: ${titles[$i]} (\e[33m\e[1m${uploaders[$i]}\e[0m)\n"
|
||||
done
|
||||
echo -ne " \e[1mq\e[0m: Quit\n"
|
||||
echo -ne "\nSelection: "
|
||||
read selection
|
||||
while [[ ! "${selections[@]}" =~ "${selection}" ]]
|
||||
|
|
@ -152,6 +153,10 @@ then
|
|||
echo -ne "Not valid, try again: "
|
||||
read selection
|
||||
done
|
||||
if [ "$selection" = "q" ]
|
||||
then
|
||||
exit
|
||||
fi
|
||||
echo ""
|
||||
url=${urls[$selection]}
|
||||
title=${titles[$selection]}
|
||||
|
|
@ -176,11 +181,9 @@ play "$url" "$title" "$uploader"
|
|||
|
||||
if [ "$interactive" = true ]
|
||||
then
|
||||
quit=false
|
||||
selections=(0 1 2 3 4 5 6 7 8 9 q)
|
||||
while [ ! "$quit" = true ]
|
||||
while :
|
||||
do
|
||||
echo -ne "\nSelect another or press [q] to quit: "
|
||||
echo -ne "\nSelect another or enter [q] to quit: "
|
||||
read selection
|
||||
while [[ ! "${selections[@]}" =~ "${selection}" ]]
|
||||
do
|
||||
|
|
@ -195,7 +198,7 @@ then
|
|||
uploader=${uploaders[$selection]}
|
||||
play "$url" "$title" "$uploader"
|
||||
else
|
||||
quit=true
|
||||
exit
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue