I was having a few problems with rdairplay crashing randomly and
leaving silence on air. I made a script to check if it is running and
restart if neccessary and delete the rdairplaylock file.
I hope someone finds this usefull.
I think someone wrote something similar a while back using a while
loop or something.
You could run it periodically using crontab if you wished?
When you save this file dont include the word "rdairplay" as part of
the file name or else the running of this script will show up as an
"rdairplay" process on your system. I called my script checkrdair.sh
... but you can choose a name that suits you.
#!/bin/bash
# This returns a value of 0 (if not running) or 1 (if rdairplay running)
statusrdairplay=`ps x | grep -v grep | grep -c rdairplay`
echo $statusrdairplay
if [ $statusrdairplay = "1" ]; then
echo "rdairplay is running"
else
# Remove rdlockfile Change the path to the rdairplaylock file on your set up.
rm /home/geoff2/.rdairplaylock
# Start rdairplay
/usr/bin/rdairplay &
#Pause for 10 seconds to give rdairplay time to start up prior the
running rmlsend command
sleep 10
#Optional you could add this rmlsend line here to play next track if you wished
rmlsend PN\ 1\!
fi
exit
Wednesday, August 27, 2014
Friday, August 1, 2014
Connecting to a Remote Webstream with Rivendell
Rivendell Macro Cart.
Note this can be triggered during ordinary playback on rdairplay to connect as required.
RN /home/USERNAME/scripts/stream-connect-script.sh! < script that starts mplayer connected to remote stream (while loop) through 3rd sound card.
SP 10! < Sleep 10 ms
RN /home/USERNAME/scripts/openinput.sh! < script that open channel on Line Input (1st sound card) so 3rd soundcard output connects to it.
SP 10!
PM 3! < Switches Rdairplay to Manual Mode
LB Starting stream in 10 seconds!
SP 2000!
LB Starting stream in 8 seconds!
SP 2000!
LB Starting stream in 6 seconds!
SP 2000!
LB Starting stream in 4 seconds!
SP 2000!
LB Starting stream in 2 seconds!
SP 2000!
LB Remote Stream On!
PS 0 5000! < Stop Machine playing out with a 5 second fadeout
SP 5000!
-------------------------------------------------------------------------------------------------------------------------
stream-connect-script.sh
#!/bin/bash
#Note: Playing sound out of 3rd sound card hw2,0 (1st card hw0,0 and 2nd card hw1,0)
sleep 11
while [ true ]
do
mplayer -ao alsa:device=hw=2,0 http://actual-url-of-stream:8000
sleep 3
done
---------------------------------------------------------------------------------------------------------------------------------
openinput.sh
#!/bin/bash
sleep 13
# open amixer Line input channel to 90% volume, (adjust on audio level of stream.)
amixer -c 0 sset Line,0 90%,90%
Note this can be triggered during ordinary playback on rdairplay to connect as required.
RN /home/USERNAME/scripts/stream-connect-script.sh! < script that starts mplayer connected to remote stream (while loop) through 3rd sound card.
SP 10! < Sleep 10 ms
RN /home/USERNAME/scripts/openinput.sh! < script that open channel on Line Input (1st sound card) so 3rd soundcard output connects to it.
SP 10!
PM 3! < Switches Rdairplay to Manual Mode
LB Starting stream in 10 seconds!
SP 2000!
LB Starting stream in 8 seconds!
SP 2000!
LB Starting stream in 6 seconds!
SP 2000!
LB Starting stream in 4 seconds!
SP 2000!
LB Starting stream in 2 seconds!
SP 2000!
LB Remote Stream On!
PS 0 5000! < Stop Machine playing out with a 5 second fadeout
SP 5000!
-------------------------------------------------------------------------------------------------------------------------
stream-connect-script.sh
#!/bin/bash
#Note: Playing sound out of 3rd sound card hw2,0 (1st card hw0,0 and 2nd card hw1,0)
sleep 11
while [ true ]
do
mplayer -ao alsa:device=hw=2,0 http://actual-url-of-stream:8000
sleep 3
done
---------------------------------------------------------------------------------------------------------------------------------
openinput.sh
#!/bin/bash
sleep 13
# open amixer Line input channel to 90% volume, (adjust on audio level of stream.)
amixer -c 0 sset Line,0 90%,90%
Disconnecting from Stream
RN /home/USERNAME/scripts/stopstreams.sh!
SP 100!
RN /home/USERNAME/scripts/closeinput.sh!
PM 2!
LB Resume Playlist in 14 seconds!
SP 2000!
LB Resume Playlist in 12 seconds!
SP 2000!
LB Resume Playlist in 10 seconds!
SP 2000!
LB Resume Playlist in 8 seconds!
SP 2000!
LB Resume Playlist in 6 seconds!
SP 2000!
LB Resume Playlist in 4 seconds!
SP 2000!
LB Resume Playlist in 2 seconds!
SP 10!
PN 1!
LB The Worlds Best Radio Station!
-------------------------------------------------------------------------------------------------------------------------
stopstreams.sh!
#!/bin/bash
#Delay 13 seconds
sleep 13
#Kill Streaming processes
killall stream-connect-script.sh
killall mplayer
------------------------------------------------------------------------------------------------------------------------
closeinput.sh
#!/bin/bash
sleep 12
amixer -c 0 sset Line,0 0%,0%
SP 100!
RN /home/USERNAME/scripts/closeinput.sh!
PM 2!
LB Resume Playlist in 14 seconds!
SP 2000!
LB Resume Playlist in 12 seconds!
SP 2000!
LB Resume Playlist in 10 seconds!
SP 2000!
LB Resume Playlist in 8 seconds!
SP 2000!
LB Resume Playlist in 6 seconds!
SP 2000!
LB Resume Playlist in 4 seconds!
SP 2000!
LB Resume Playlist in 2 seconds!
SP 10!
PN 1!
LB The Worlds Best Radio Station!
-------------------------------------------------------------------------------------------------------------------------
stopstreams.sh!
#!/bin/bash
#Delay 13 seconds
sleep 13
#Kill Streaming processes
killall stream-connect-script.sh
killall mplayer
------------------------------------------------------------------------------------------------------------------------
closeinput.sh
#!/bin/bash
sleep 12
amixer -c 0 sset Line,0 0%,0%
Subscribe to:
Posts (Atom)