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

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

video=$1
shift

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