You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
569 B
24 lines
569 B
#!/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 |
|
|
|
|