13 lines
478 B
Bash
Executable file
13 lines
478 B
Bash
Executable file
#!/bin/sh
|
|
search="https://music.youtube.com/search?q="
|
|
if [ -z "$format" ]; then
|
|
options="--keep-open=yes"
|
|
search="ytsearch"
|
|
format="bv[height<=720]+ba/b"
|
|
fi
|
|
|
|
[ "$#" -gt 0 ] && url="$*" || url="$(timeout 0.1 cat)"
|
|
[ -z "$url" ] && url="$(wl-paste)"
|
|
[ -z "$url" ] && url="https://youtu.be/dQw4w9WgXcQ"
|
|
|
|
notify-send -t 1000 "$url" & mpv $options --ytdl-raw-options=default-search=$search --ytdl-format="$format" ytdl://"$url" || notify-send -t 3000 "Failed to play youtube video"
|