commit 08415306f4f6505b959641028fe4228844c36364
parent 7964505399819207dbc915a68ac5d9cea3591fee
Author: Haris <haris@feanor.lan>
Date: Sun, 3 Nov 2013 15:32:38 +0200
patch and script for surf for youtube/etc
Diffstat:
3 files changed, 34 insertions(+), 0 deletions(-)
diff --git a/surf/README b/surf/README
@@ -0,0 +1,5 @@
+Patch surf's config.h with `patch < youtube.patch`, put "yt" script on ~/bin
+and start playing videos with C-s on any page supported by youtube-dl.
+
+On yt, you can change the cache size overriding mplayer's config at
+~/.mplayer/config
diff --git a/surf/youtube.patch b/surf/youtube.patch
@@ -0,0 +1,22 @@
+--- config.h Sun Nov 3 15:24:44 2013
++++ config.h Sun Nov 3 15:27:05 2013
+@@ -44,6 +44,11 @@ static Bool allowgeolocation = TRUE;
+ } \
+ }
+
++#define WATCH {.v = (char *[]){ "/bin/sh", "-c", \
++ "st -t youtube -e \
++ yt $(xprop -id $0 _SURF_URI | cut -d \\\" -f 2)", \
++ winid, NULL } }
++
+ #define MODKEY GDK_CONTROL_MASK
+
+ /* hotkeys */
+@@ -53,6 +58,7 @@ static Bool allowgeolocation = TRUE;
+ */
+ static Key keys[] = {
+ /* modifier keyval function arg Focus */
++ { MODKEY, GDK_s, spawn, WATCH },
+ { MODKEY|GDK_SHIFT_MASK,GDK_r, reload, { .b = TRUE } },
+ { MODKEY, GDK_r, reload, { .b = FALSE } },
+ { MODKEY|GDK_SHIFT_MASK,GDK_p, print, { 0 } },
diff --git a/surf/yt b/surf/yt
@@ -0,0 +1,7 @@
+#!/bin/sh
+format="--max-quality 35" # leave empty for default
+# format="-f 35/45" # leave empty for default
+player="mplayer -idx"
+
+url="$1"
+$player `youtube-dl $format -g $url`