summaryrefslogtreecommitdiff
path: root/etc/functions/youtube-watch
blob: c7940bfd85a382c5b195416b8cf0c401dba995a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
## vim:ft=zsh
typeset video
typeset -i cache=0

while [[ $* == -* ]] {
	case $1 in
		-c) cache=1
	esac
	shift
}

video=$1
shift

if ((cache)) {
	youtube-dl -o /tmp/youtube.flv $video
	mplayer $* /tmp/youtube.flv
} else {
	mplayer $* $(youtube-dl -gb $video)
}