summaryrefslogtreecommitdiff
path: root/.local/bin/mpvsel
blob: bfd7bc3a927d0c4b036573177dac86b5ff7d23f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
#!/bin/sh
# references:
# https://www.rockyourcode.com/til-how-to-watch-youtube-videos-with-mpv-and-keyboard-shortcuts/
# https://github.com/mpv-player/mpv/issues/7792

url=$(xsel -ob)
case $url in
	*"youtu"*) mpv --ytdl-format=bestvideo[height<=?900][fps<=?30][vcodec!=?vp9]+bestaudio/best --fs --speed=2 --af=rubberband=pitch-scale=0.981818181818181 $url ;;
	*"douyu"*) alacritty -e mpv $(basename $url | python $HOME/programs/real-url/douyu.py | tail -1) ;;
	*) echo "Clipboard url not supportted." >&2; exit 1 ;;
esac