vp

git clone git://oldgit.suckless.org/vp/
Log | Files | Refs | README

commit 81c2542733c28ec72ebe1498c0ac3997dcd537ed
parent 2a4b7dd5a4c682e1fed8f54032d12c1e2e0cbbef
Author: Kris Maglione <kris@suckless.org>
Date:   Sun, 15 Aug 2010 06:58:51 -0400

Fix syntax error. Run mplayer with the cookie jar.

Diffstat:
.hgignore | 3++-
vp | 2+-
vp-base | 9++++++---
vp-xhamster | 18++++++++++++++++++
4 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/.hgignore b/.hgignore @@ -1,3 +1,4 @@ -test.html config.local.mk +test.html +vp-patterns .*.sw? diff --git a/vp b/vp @@ -22,7 +22,7 @@ if(~ $flagf '') vp_play $vp_result if not { if(~ $flago '') - flago = `{vp_autoname $vp_orig $vp_result}) + flago = `{vp_autoname $vp_orig $vp_result} if(~ $flago '') $vp_hget_loud $vp_hget_autoname $vp_result if not $vp_hget_loud >$flago $vp_result } diff --git a/vp-base b/vp-base @@ -8,7 +8,6 @@ if(~ $vp_base_loaded '') { fn vp_default { if (~ $$1 '') $1 = $2 } vp_default XDG_CONFIG_HOME $home ^ /.config - vp_default PLAYER mplayer args=$* vp_cookie_jar=$XDG_CONFIG_HOME ^ /cookies.txt @@ -25,9 +24,13 @@ if(~ $vp_base_loaded '') { vp_hget_loud=($vp_hget '-#') vp_hget_silent=($vp_hget -s) - fn vp_paste { xsel -o || sselp } - fn vp_player { $PLAYER $* } fn vp_autoname { true } + fn vp_paste { xsel -o || sselp } + + # IMPORTANT: Unset this if you use a player that does + # not read its cookies from $vp_cookie_jar + vp_have_player_cookies = 1 + fn vp_player { mplayer -cookies -cookies-file $vp_cookie_jar $* } fn js { builtin js || kjs /dev/stdin } diff --git a/vp-xhamster b/vp-xhamster @@ -0,0 +1,18 @@ +#!/usr/bin/env rc +# +# Pattern: ^http://xhamster.com/movies/ + +. vp-base $0 $* + +vp_result `{vp_data $* | awk ' + END { print a["srv"] "/" a["type"] "2/" a["file"] } + /^[ ]*''[a-z]+'':/ { + sub(/^[ ]*''/, "") + name = $0 + sub(/''.*/, "", name) + sub(/[^:]*'' *: *''/, "") + sub(/''.*/, "") + a[name] = $0 + } +'} +