Guest User

/usr/bin/tv_grab_wg++

a guest
Mar 12th, 2025
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.44 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. xmltv_file_location=/tmp/guide.xml
  4. socket_location=/var/lib/tvheadend/epggrab/xmltv.sock
  5.  
  6. # Download the xml file
  7. /usr/bin/tv_grab_melbourne > $xmltv_file_location
  8.  
  9. # Remove one line - doesn't seem to affect behaviour
  10. sleep 2
  11. sed -i -e '/<!DOCTYPE tv SYSTEM "xmltv.dtd">/d' $xmltv_file_location
  12.  
  13. dflag=
  14. vflag=
  15. cflag=
  16. if (( $# < 1 ))
  17. then
  18.   cat "$xmltv_file_location"
  19.   cat "$xmltv_file_location" | /usr/bin/socat - UNIX-CONNECT:"$socket_location"
  20.   exit 0
  21. fi
  22.  
  23. for arg
  24. do
  25.     delim=""
  26.     case "$arg" in
  27.     #translate --gnu-long-options to -g (short options)
  28.        --description) args="${args}-d ";;
  29.        --version) args="${args}-v ";;
  30.        --capabilities) args="${args}-c ";;
  31.        #pass through anything else
  32.        *) [[ "${arg:0:1}" == "-" ]] || delim="\""
  33.            args="${args}${delim}${arg}${delim} ";;
  34.     esac
  35. done
  36.  
  37. #Reset the positional parameters to the short options
  38. eval set -- $args
  39.  
  40. while getopts "dvc" option
  41. do
  42.     case $option in
  43.         d)  dflag=1;;
  44.         v)  vflag=1;;
  45.         c)  cflag=1;;
  46.         \?) printf "unknown option: -%s\n" $OPTARG
  47.             printf "Usage: %s: [--description] [--version] [--capabilities] \n" $(basename $0)
  48.             exit 2
  49.             ;;
  50.     esac >&2
  51. done
  52.  
  53. if [ "$dflag" ]
  54. then
  55.    printf "$0 is a wrapper grabber around WebGrab+Plus\n"
  56. fi
  57. if [ "$vflag" ]
  58. then
  59.    printf "0.1\n"
  60. fi
  61. if [ "$cflag" ]
  62. then
  63.    printf "baseline\n"
  64. fi
  65.  
  66. exit 0
Advertisement
Add Comment
Please, Sign In to add comment