Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- FRQ=88.5
- SID=0420
- PPM=22
- SSID="TEST"
- F_RDS="TEST"
- F_FILE="http://10.42.0.13:5738/stream"
- F_META="http://10.42.0.13:5738/rds.xsl"
- F_CTL="/root/_fmctl"
- Z_RAD_PID=0
- trap ctrl_c INT
- function ctrl_c() {
- echo "** Caught CTRL-C"
- if [ ${Z_RAD_PID} > 0 ] ; then
- echo "** Stopping transmission"
- kill ${Z_RAD_PID} 2>/dev/null
- if [ -e "${F_CTL}" ]; then
- echo "** Cleaning up transmitter control pipe"
- rm -f "${F_CTL}"
- fi
- exit
- fi
- }
- if [ ! -e "${F_CTL}" ]; then
- mkfifo "${F_CTL}"
- fi
- cd /home/pi/dev/rpitx
- ffmpeg -loglevel warning -i "${F_FILE}" -c:a pcm_s16le -ac 2 -ar 48000 -f wav - | \
- ./pifmrds -freq ${FRQ} -ppm ${PPM} -pi ${SID} -ps ${SSID} -rt "${F_RDS}" -ctl "${F_CTL}" -audio - &
- Z_RAD_PID=$!
- METADATA=""
- METADATA_L=""
- while (true); do
- METADATA=$(curl -sL "${F_META}")
- if [ "${METADATA}" != "${METADATA_L}" ]; then
- if [ -e "${F_CTL}" ]; then
- # ctl stuff
- # echo "PS ${SSID}" > "${F_CTL}"
- echo "RT ${METADATA}" > "${F_CTL}"
- fi
- METADATA_L="${METADATA}"
- fi
- sleep 3;
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement