Guest User

tv_grab_wg++

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