summaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
Diffstat (limited to 'etc')
-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)
+}