|
|
2010-03-14
, 08:14
|
|
Posts: 122 |
Thanked: 9 times |
Joined on Feb 2010
@ France
|
#2
|

#!/bin/bash
declare p_pid
declare RHOST
RHOST=`dig LU-NT-STREAM01.bce.lu | grep "^LU-NT-STREAM01.bce.lu" | awk '{print $5}'`
play() {
mplayer mms://LU-NT-STREAM01.bce.lu/Alpha989 &> /dev/null &
sleep 2
p_pid=`ps -ef | grep "[m]pla" | tail -n 1 | awk '{print $2}'`
}
cleanup() {
kill -15 ${p_pid}
sleep 5
kill -9 ${p_pid} &> /dev/null
unset p_pid
unset RHOST
}
trap cleanup TERM
play
while [ 1 ]; do
/bin/kill -0 ${p_pid} 2> /dev/null
if [ $? -ne 0 ]; then
netstat -an | grep $RHOST &> /dev/null
while [ $? -eq 0 ]; do
sleep 0.5
netstat -an | grep $RHOST &> /dev/null
done
play
fi
sleep 0.1
done
I'm using KMPlayer to play radio streams, which works pretty good.
I just have one annoyance:
When I'm in bad 3G coverage the stream stops playing and I have to manually unlock the device, press play, and so forth.
Is there a way to set KMPlayer to automatically retry playing the same stream?
If not, could the author of KMplayer implement this if he/she is reading this?