34 lines
539 B
Bash
Executable File
34 lines
539 B
Bash
Executable File
#! /bin/bash
|
|
|
|
set -e
|
|
|
|
|
|
server="localhost:5000"
|
|
radio="sdrplay"
|
|
frequency="105.5M"
|
|
|
|
trap deinit INT
|
|
|
|
deinit() {
|
|
curl $server/radio/$radio/end
|
|
curl $server/radio/$radio/disconnect
|
|
#kill $pid
|
|
killall ffplay
|
|
echo -n ""
|
|
}
|
|
|
|
init() {
|
|
curl $server/radio/$radio/connect
|
|
curl $server/radio/$radio/configure/$frequency
|
|
curl $server/radio/$radio/start
|
|
}
|
|
|
|
init
|
|
echo "Waiting for stream to become active..."
|
|
sleep 3
|
|
ffplay -nodisp -hide_banner rtsp://localhost:8554/radio/sdrplay &
|
|
pid=$!
|
|
|
|
while true; do
|
|
sleep 1
|
|
done |