utilies

A handful of (useful) scripts for unix-like systems
Log | Files | Refs | README | LICENSE

spv (530B)


      1 #!/bin/bash
      2 
      3 # Search Play Video
      4 
      5 [ "$1" != "" ] && query="$@" || query=`rofi -dmenu -p "Finn video" -lines 0`
      6 [ "$query" = "" ] && exit 1
      7 
      8 # json=`youtube-dl ytsearch:"$query" -x - | sed 1q`
      9 json=`youtube-dl ytsearch:"$query" -j`
     10 
     11 title=`echo $json | jq ".title"`
     12 url=`echo $json | jq ".formats | map(select(.vcodec==\"none\")) | .[-1].url"`
     13 channel=`echo $json | jq ".uploader"`
     14 
     15 _trimquotes () {
     16 	temp="${1%\"}"
     17 	echo "${temp#\"}"
     18 }
     19 
     20 notify-send "`_trimquotes "$title"`" "`_trimquotes "$channel"`"
     21 
     22 mpv "`_trimquotes "$url"`"
     23