From 34c38eb75c20e2759b4d5886da8da0787532222b Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 4 Mar 2009 19:06:59 +0100 Subject: youtube-watch: Support for completely caching the video --- etc/functions/youtube-watch | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/etc/functions/youtube-watch b/etc/functions/youtube-watch index ccf096d..c7940bf 100755 --- a/etc/functions/youtube-watch +++ b/etc/functions/youtube-watch @@ -1,4 +1,20 @@ ## vim:ft=zsh -typeset video=$1 +typeset video +typeset -i cache=0 + +while [[ $* == -* ]] { + case $1 in + -c) cache=1 + esac + shift +} + +video=$1 shift -mplayer $* $(youtube-dl -g $video) + +if ((cache)) { + youtube-dl -o /tmp/youtube.flv $video + mplayer $* /tmp/youtube.flv +} else { + mplayer $* $(youtube-dl -gb $video) +} -- cgit v1.2.3