add audio only
This commit is contained in:
parent
3f5211e0b1
commit
ac9aa8c0db
2 changed files with 54 additions and 14 deletions
36
README.org
36
README.org
|
|
@ -39,7 +39,7 @@ This function prints the usage of the script.
|
|||
|
||||
#+begin_src sh
|
||||
function print_usage {
|
||||
echo "tyt [ (-a* | --alternative) | (-i | --interactive) ] \"QUERY\""
|
||||
echo "tyt [ (-a* | --alternative) | (-i | --interactive) | (-m | --music) ] \"QUERY\""
|
||||
}
|
||||
#+end_src
|
||||
|
||||
|
|
@ -50,6 +50,7 @@ We have the following flags:
|
|||
|
||||
- =a*|alternative= :: Alternative video (optional); You can parse any amount of alternatives (e.g. =-aaa=)
|
||||
- =i|interactive= :: Interactive mode; Shows the first 10 results and queries for a selection; If this flag is set, =-a= is ignored
|
||||
- =m|music= :: Play only the audio track of the video
|
||||
|
||||
Additionally we have exacly one mandatory quoted string as query.
|
||||
|
||||
|
|
@ -57,6 +58,7 @@ Additionally we have exacly one mandatory quoted string as query.
|
|||
alternative=0
|
||||
format="flac"
|
||||
interactive=false
|
||||
music=false
|
||||
help=false
|
||||
|
||||
for arg in "$@"
|
||||
|
|
@ -71,10 +73,14 @@ Additionally we have exacly one mandatory quoted string as query.
|
|||
alternative=1
|
||||
shift
|
||||
;;
|
||||
-i|--interactive)
|
||||
-i|--interactive)
|
||||
interactive=true
|
||||
shift
|
||||
;;
|
||||
-m|--music)
|
||||
music=true
|
||||
shift
|
||||
;;
|
||||
-h|--help)
|
||||
help=true
|
||||
shift
|
||||
|
|
@ -104,12 +110,22 @@ Additionally we have exacly one mandatory quoted string as query.
|
|||
*** Greeter
|
||||
|
||||
If the arguments match, print a greeter.
|
||||
Another greeter is printed if the flag =-m= is set.
|
||||
Make sure your terminal emulator supports Unicode to see the notes.
|
||||
|
||||
#+begin_src sh
|
||||
echo -ne "\n \e[1m\ /\e[0m\n"
|
||||
echo -ne " \e[1m=======\e[0m\n"
|
||||
echo -ne " \e[1m| \e[31mtyt\e[0m \e[1m|\e[0m\n"
|
||||
echo -ne " \e[1m=======\e[0m\n\n"
|
||||
if [ "$music" = false ]
|
||||
then
|
||||
echo -ne "\n \e[1m\ /\e[0m\n"
|
||||
echo -ne " \e[1m=======\e[0m\n"
|
||||
echo -ne " \e[1m| \e[31mtyt\e[0m \e[1m|\e[0m\n"
|
||||
echo -ne " \e[1m=======\e[0m\n\n"
|
||||
else
|
||||
echo -ne "\n \e[1m\ /\e[0m ♫\n"
|
||||
echo -ne " \e[1m=======\e[0m ♫\n"
|
||||
echo -ne " \e[1m| \e[31mtyt\e[0m \e[1m|\e[0m\n"
|
||||
echo -ne " \e[1m=======\e[0m\n\n"
|
||||
fi
|
||||
#+end_src
|
||||
|
||||
*** Get URL
|
||||
|
|
@ -203,8 +219,14 @@ If the interactive flag is present, show the first ten results and query for a v
|
|||
*** Play video
|
||||
|
||||
Finally the video is played via mpv.
|
||||
If the =-m= flag is set, only the audio track is played.
|
||||
|
||||
#+begin_src sh
|
||||
echo -ne "Playing: \e[32m\e[1m$title\e[0m (\e[33m\e[1m$uploader\e[0m)\n"
|
||||
mpv $url &> /dev/null
|
||||
if [ "$music" = true ]
|
||||
then
|
||||
mpv --no-video $url &> /dev/null
|
||||
else
|
||||
mpv $url &> /dev/null
|
||||
fi
|
||||
#+end_src
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue