File: radio.sh

package info (click to toggle)
poc-streamer 0.4.2-7
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 1,000 kB
  • sloc: ansic: 8,782; makefile: 307; ruby: 152; perl: 135; yacc: 115; lex: 36; sh: 30
file content (36 lines) | stat: -rwxr-xr-x 817 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash

export PATH=$PATH:/usr/local/bin

rtp_port=1500
rtp_host=224.0.1.23
rtp_cert=

while [ $# -gt 0 ]
do
    case "$1" in
        -h)  rtp_host="$2"; shift;;
        -p)  rtp_port="$2"; shift;;
        -c)  rtp_cert="$2"; shift;;
        --)  shift; break;;
        -*)
            echo >&2 \
            "usage: $0 [-h rtp_host] [-p rtp_port] [-c rtp_cert] http_host http_port"
            exit 1;;
        *)  break;;     # terminate while loop
    esac
    shift
done

while true; do
   print -n "GET / HTTP/1.0\r\n\r\n" | nc $1 $2 | \
            buffer | \
               (if [ $rtp_cert ]; then
                   ./poc -c $rtp_cert -p $rtp_port -s $rtp_host -
                else
                   ./poc -p $rtp_port -s $rtp_host -
                fi;)

   print "Reconnecting..."
   sleep 120
done