BIN: Deletes open-youtube and puts functionality in yt
The yt script now accepts a --url option which will take a url as an option like yt --url youtube.com/watch?v=blar or echo youtube.com/watch?v=blar | yt --url It will also use rofi rather than fzf if not being run from a terminal or the --rofi flag is given I have updated the files that used to use open-youtube to reflect this
This commit is contained in:
parent
c619f884bd
commit
99736427be
5 changed files with 99 additions and 52 deletions
|
@ -20,5 +20,7 @@ url="$(curl https://ippsec.rocks/dataset.json 2>/dev/null |\
|
|||
fzf -d ' ' --with-nth '3,2' --header-lines 1 --preview-window 'up:1' --preview 'bash -c '\''buildURL "$0"'\'' {}' |\
|
||||
buildURL)"
|
||||
|
||||
open-youtube "$url"
|
||||
echo "$url"
|
||||
|
||||
yt "$url"
|
||||
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
isxclient=$( readlink /dev/fd/2 | grep -q 'tty' && [[ -n $DISPLAY ]] ; echo $? )
|
||||
if [[ ! -t 2 || $isxclient == "0" ]]; then
|
||||
DMENU="rofi -dmenu -p"
|
||||
else
|
||||
DMENU="fzf --prompt"
|
||||
fi
|
||||
|
||||
url="$1"
|
||||
|
||||
if [ -z "$url" ]; then
|
||||
url=$($DMENU 'URL')
|
||||
fi
|
||||
|
||||
code=$( ( youtube-dl "$url" -F; echo "bb Best of both") | sed -n '/format code/,$ p' | tail -n +2 | $DMENU "Quality " -m | awk '{print $1}')
|
||||
|
||||
code="$(echo "$code" | tr '\n' '+' | sed 's/+$//')"
|
||||
|
||||
case "$code" in
|
||||
"bb") mpv "$url" --ytdl-format="bestvideo+bestaudio" ;;
|
||||
*) mpv "$url" --ytdl-format="$code"
|
||||
esac
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue