Skip to content

Instantly share code, notes, and snippets.

@LuisPalacios
Last active May 28, 2021 07:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LuisPalacios/b6242399229b87d86d28f9db540f66bd to your computer and use it in GitHub Desktop.
Save LuisPalacios/b6242399229b87d86d28f9db540f66bd to your computer and use it in GitHub Desktop.
Script de apoyo a Tvheadend para “leer” el fichero XMLTV (descrito en https://www.luispa.com/tv/2016/02/28/tvh-movistar-2016.html)
#!/bin/bash
xmltv_file_location=/home/luis/guia/guia.xml
dflag=
vflag=
cflag=
qflag=
if (( $# < 1 ))
then
cat "$xmltv_file_location"
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 ";;
--quiet) args="${args}-q ";;
#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 "dvcq" option
do
case $option in
d) dflag=1;;
v) vflag=1;;
c) cflag=1;;
q) qflag=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 "$0 is a wrapper grabber around Movistar TV\n"
fi
if [ "$vflag" ]
then
printf "0.2\n"
fi
if [ "$cflag" ]
then
printf "baseline\n"
fi
if [ "$qflag" ]
then
printf ""
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment