index.md (1037B)
1 Watch flash videos with mpv 2 =========================== 3 4 Description 5 ----------- 6 7 Save this script as ~/bin/yt and adjust it to your needs. (Requires [youtube-dl](http://rg3.github.io/youtube-dl/)) 8 9 10 #!/bin/sh 11 format="-f34" # leave empty for default 12 player="mpv --quiet --geometry=50%:50% --idx --keep-open" 13 tmpdir="$HOME/tmp" 14 15 url="$1" 16 filepath="$tmpdir/$(youtube-dl --id --get-filename $format $url)" 17 18 youtube-dl -c -o $filepath $format $url & 19 echo $! > $filepath.$$.pid 20 21 while [ ! -r $filepath ] && [ ! -r $filepath.part ]; do 22 echo "Waiting for youtube-dl..." 23 sleep 3 24 done 25 26 [ -r $filepath.part ] && $player $filepath.part || $player $filepath 27 kill $(cat $filepath.$$.pid) 28 rm $filepath.$$.pid 29 30 31 Add this to surf's config.h: 32 33 34 #define WATCH {.v = (char *[]){ "/bin/sh", "-c", \ 35 "st -e \ 36 yt $(xprop -id $0 _SURF_URI | cut -d \\\" -f 2)", \ 37 winid, NULL } } 38 39 40 and in the keys section: 41 42 43 { MODKEY, GDK_w, spawn, WATCH }, 44 45 46 Author 47 ------ 48 * Maximilian Dietrich - <dxm_at_lavabit_dot_com>