summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxyz <gky44px1999@gmail.com>2021-07-17 09:09:01 -0700
committerxyz <gky44px1999@gmail.com>2021-07-17 09:09:01 -0700
commit78ec367d1fe1dd5b08276d8d40c51d526fc4b6b0 (patch)
treedab6213cb4e2a3ae4ef0609e853b66d994f4e358
parent81c3396d83fd72d5c80ba9b4287e25212ad295f5 (diff)
mpv xsel youtube douyu video & streaming
-rw-r--r--.config/sxhkd/sxhkdrc3
-rwxr-xr-x.local/bin/mpvsel11
2 files changed, 14 insertions, 0 deletions
diff --git a/.config/sxhkd/sxhkdrc b/.config/sxhkd/sxhkdrc
index e1a37403..e01a1dcc 100644
--- a/.config/sxhkd/sxhkdrc
+++ b/.config/sxhkd/sxhkdrc
@@ -3,3 +3,6 @@ alt + Print
XF86Audio{RaiseVolume,LowerVolume,Mute}
amixer set Master {5%+,5%-,toggle}
+
+alt + y
+ mpvsel
diff --git a/.local/bin/mpvsel b/.local/bin/mpvsel
new file mode 100755
index 00000000..4225bcc1
--- /dev/null
+++ b/.local/bin/mpvsel
@@ -0,0 +1,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 --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