summaryrefslogtreecommitdiff
path: root/etc/functions
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2009-03-04 19:06:59 +0100
committerDaniel Friesel <derf@derf.homelinux.org>2009-03-04 19:06:59 +0100
commit34c38eb75c20e2759b4d5886da8da0787532222b (patch)
tree5ec308a588aa72e36e0ae35ac7c8b2533e62b0d3 /etc/functions
parent9ff806a2799e74d038692fc95a53adb3ba33eebd (diff)
youtube-watch: Support for completely caching the video
Diffstat (limited to 'etc/functions')
-rwxr-xr-xetc/functions/youtube-watch20
1 files 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)
+}