Skip to content

Instantly share code, notes, and snippets.

@dz0ny
Created December 3, 2011 21:16
Show Gist options
  • Save dz0ny/1428173 to your computer and use it in GitHub Desktop.
Save dz0ny/1428173 to your computer and use it in GitHub Desktop.
XMLTV Slovenia
#!/bin/bash
dflag=
vflag=
cflag=
if (( $# < 1 ))
then
echo '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><tv source-data-url="http://tvprofil.net/xmltv/" source-info-name="Phazer XML servis 4.1" source-info-url="http://tvprofil.net">'
wget -qO - http://tvprofil.net/xmltv/data/kanal-a.si/weekly_kanal-a.si_tvprofil.net.xml | tail -n+2 | tail -n+2 | sed '$d'
wget -qO - http://tvprofil.net/xmltv/data/pop-tv.si/weekly_pop-tv.si_tvprofil.net.xml | tail -n+2 | tail -n+2 | sed '$d'
wget -qO - http://tvprofil.net/xmltv/data/slo1.si/weekly_slo1.si_tvprofil.net.xml | tail -n+2 | tail -n+2 | sed '$d'
wget -qO - http://tvprofil.net/xmltv/data/slo2.si/weekly_slo2.si_tvprofil.net.xml | tail -n+2 | tail -n+2 | sed '$d'
wget -qO - http://tvprofil.net/xmltv/data/slo3.si/weekly_slo3.si_tvprofil.net.xml | tail -n+2 | tail -n+2 | sed '$d'
wget -qO - http://tvprofil.net/xmltv/data/koper.si/weekly_koper.si_tvprofil.net.xml | tail -n+2 | tail -n+2 | sed '$d'
echo "</tv>"
exit 0
fi
for arg
do
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} ";;
esac
done
#Reset the positional parameters to the short options
eval set -- $args
while getopts "dvc" option
do
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
done
if [ "$dflag" ]
then
printf "Slovenia"
fi
if [ "$vflag" ]
then
printf "0.1\n"
fi
if [ "$cflag" ]
then
printf "baseline\n"
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment