add youtube-dl audo and video delegator

This commit is contained in:
Felix Van der Jeugt 2022-09-20 15:53:09 +02:00
parent 7231c3e343
commit 99b4abc9b1

View File

@ -34,6 +34,8 @@ clipmenu
yubikey yubikey
emoji emoji
spotify-title spotify-title
youtube-dl
audio-dl
HERE HERE
)" )"
@ -87,6 +89,24 @@ case "$choice" in
inject "${choice##* }" inject "${choice##* }"
;; ;;
'spotify-title') 'spotify-title')
inject "$(curl -L "$(xclip -o)" | sed -n 's@.*<title>\(.*\) - song by \(.*\) | Spotify</title>.*@\1 - \2@p')" inject "$(curl -L "$(xclip -o)" | sed -n 's@.*<title>\(.*\) - song \(and lyrics \)\?by \(.*\) | Spotify</title>.*@\1 - \3@p')"
;;
'youtube-dl')
d="$(mktemp -d)"
trap "rm -r '$d'" EXIT KILL
cd "$d"
yt-dlp "$(xclip -o)"
if mplayer -v >/dev/null; then
exec st mplayer *
else
exec st mpv *
fi
;;
'audio-dl')
d="$(mktemp -d)"
trap "rm -r '$d'" EXIT KILL
cd "$d"
yt-dlp -x "$(xclip -o)"
exec st mpv --no-video *
;; ;;
esac esac