tv_grab_file 1001 Bytes
Newer Older
Igor Pečovnik's avatar
Igor Pečovnik committed
1
2
3
4
5
6
#!/bin/bash
dflag=
vflag=
cflag=
if (( $# < 1 ))
then
Aristo Chen's avatar
Aristo Chen committed
7
8
9
	### URL of your XML file
	wget -qO - "http://xml.tv.data"
	exit 0
Igor Pečovnik's avatar
Igor Pečovnik committed
10
11
12
13
fi

for arg
do
Aristo Chen's avatar
Aristo Chen committed
14
15
16
17
18
19
20
21
22
	delim=""
	case "$arg" in
		#translate --gnu-long-options to -g (short options)
		--description) args="${args}-d ";;
		--version) args="${args}-v ";;
		--capabilities) args="${args}-c ";;
		#pass through anything else
		*) [[ "${arg:0:1}" == "-" ]] || delim="\""
		args="${args}${delim}${arg}${delim} ";;
Igor Pečovnik's avatar
Igor Pečovnik committed
23
24
25
26
27
28
    esac
done

#Reset the positional parameters to the short options
eval set -- $args

Aristo Chen's avatar
Aristo Chen committed
29
while getopts "dvc" option
Igor Pečovnik's avatar
Igor Pečovnik committed
30
do
Aristo Chen's avatar
Aristo Chen committed
31
32
33
34
35
36
37
38
39
	case $option in
		d)  dflag=1;;
		v)  vflag=1;;
		c)  cflag=1;;
		\?) printf "unknown option: -%s\n" $OPTARG
			printf "Usage: %s: [--description] [--version] [--capabilities] \n" $(basename $0)
			exit 2
			;;
	esac >&2
Igor Pečovnik's avatar
Igor Pečovnik committed
40
41
42
43
done

if [ "$dflag" ]
then
Aristo Chen's avatar
Aristo Chen committed
44
	printf "tv_grag_file is a simple grabber that just read the ~/.xmltv/tv_grab_file.xmltv file\n"
Igor Pečovnik's avatar
Igor Pečovnik committed
45
46
47
fi
if [ "$vflag" ]
then
Aristo Chen's avatar
Aristo Chen committed
48
	printf "0.1\n"
Igor Pečovnik's avatar
Igor Pečovnik committed
49
50
51
fi
if [ "$cflag" ]
then
Aristo Chen's avatar
Aristo Chen committed
52
	printf "baseline\n"
Igor Pečovnik's avatar
Igor Pečovnik committed
53
54
55
fi

exit 0