scripts

scripts
git clone git://git.wimdupont.com/scripts.git
Log | Files | Refs | README | LICENSE

yt (594B)


      1 #!/bin/bash
      2 
      3 number=1
      4 audio=--vid=auto
      5 
      6 while getopts ":ahn:" arg; do
      7   case $arg in
      8     a) audio=--no-video;;
      9     n) number=$OPTARG;;
     10     h) echo "
     11 	CLI youtube player
     12 
     13 	type in search query with optional arguments:
     14 	
     15 	-a 	:	audio only
     16 	-n {n}	:	{n} as number of videos to search (default:1)
     17 	-h 	:	for this help menu 
     18 	
     19 	EXAMPLES:
     20 	$ yt why use free sofware
     21 	$ yt -n 5 -a best songs ever
     22 	"
     23 	exit 0;;
     24   esac
     25 done
     26 
     27 shift $((OPTIND-1))
     28 
     29 query=$@
     30 
     31 if [[ -z "$query" ]]; then
     32 	echo "Please enter search query argument (-h for help)" >&2
     33 	exit 1
     34 fi
     35 
     36 mpv "$audio" ytdl://ytsearch"$number":"$query"