I forgot about the /r problem, I used tr to strip it like this:
REPLY=$(echo $REPLY | tr -d '\r') #Remove any end of line chars
I have no idea if it is faster than sed.
On 2016-07-12 22:50, Robert Jeffares wrote:
Thanks Wayne,
just the nudge I needed to take an alternate look.
I set up a UDP RLM like this
[Udp1]
IpAddress=127.0.0.1
UdpPort=5861
FormatString=CART=%n BCTIME=%d(hh:mm)n
Encoding=0
ProcessNullUpdates=1
MasterLog=Yes
Aux1Log=No
Aux2Log=No
Since I only want to get data for the one CART when it plays, I run
nc from within the shell script for as long as it takes.
# takes the udp output of RDAIRPLAY looks for line with CART
# adds it to log
nc -d -u -l 5861 | (
while read -t 1800 REPLY; do
# time out set to 3 minutes in case cart gets bumped by time event
#REPLY is default output of read
if [[ "$REPLY" == *"CART=002005"* ]]; then
#when we get it peel of broadcast time and put it in log
echo "${REPLY:(-13)}" > /home/rd/zexacary.log
break
fi
done
)
exit 0
I could have set the CART as a variable; this is the quick and
dirty.
The script carts and plays each item 3 times over 70 minutes.
The log gets emailed to me.
I had to use sed to get rid of the 'r' in the lines that are
generated by the UDP RLM so the data comes as a message not as an
attachment.
I decided to run nc as needed. One less permanent process. Accurate
reporting when you have three up at any time.
It runs every 10 minutes. When there is a bulletin the script gives
each instance a unique ID so it is possible to have several info
bulletins running simultaneously. ' Weather events as they happen'
play in a FIFO series of snippets just often enough.
In this area we get 'weather bombs' about once every 18 months. Some
are supposed to be once in 20 and once in 50 year events.
When you get 200mm of rain in a few hours on the top of a steep
sided
mountain range it's got two ways to flow and both of them are down.
The flat area at the bottom on both sides of a 50km ridge is between
500m and 2km from the ocean. When the rain hits the [king] high tide
the rivers back up and everything floods. First storm in a while it
takes time. The second one while everything is still wet is the
jackpot.
We're in between a significant one and a follow up one right now!
It's never a question of if it's going to happen it's more where.
People who come on holidays and weekends, still insist on trying to
drive everywhere, ford flooded rivers, complain when the power goes
out, and wonder why it takes so log to get trucks and excavators past
all sorts of blockages to clear something outside their place.
The locals have an unkind name for such people.
I have had the playout script running for a while. Now I can produce
a log of actual broadcast times. This along with archive copies of
all
announcements helps local Civil Defence demonstrate that they are
doing their best. Our CD media liason is an ex radio guy and when
it's
really turning pear shaped delivers audio bulletins every 15 minutes.
Thanks again Wayne, and RD, keeping radio always on, always local.
regards
Robert
On 10/07/16 02:46, Wayne Merricks wrote:
Hi,
I used the UDP rlm to do this in house as I found the icecast rlm
to sometimes do strange things in our weird set up. I have the
following udp conf (for rlm):
[Udp1]
IpAddress=127.0.0.1
UdpPort=5860
FormatString=CART=%nnTITLE=%tnARTIST=%anALBUM=%lnMS=%hn
Encoding=0
ProcessNullUpdates=1
MasterLog=Onair
Aux1Log=No
Aux2Log=No
Obviously remove the bits you don't need, I assume you could
literally stick with a cart number as:
FormatString=%nn
That way you're just dealing with cart numbers and nothing else
each time.
Then I have a reader script that just does this:
CARTNUM=123456
while true; do
read RAWDATA
if [[ $RAWDATA == $CARTNUM ]]; then
#This is the cart you wanted do something
fi
done
In order to start the listening port I use nc and another script
(via screen):
screen -d -m -S updreader bash -c "nc -l -u -p 5860 |
/path/to/reader/script.sh"
Hope that makes sense,
Wayne
On 2016-07-09 00:40, Robert Jeffares wrote:
I have a script which picks up [road] traffic information from a
dropbox and plays it 3 times.
Audio is carted using rdimport and using RML PX it gets placed
next
and goes to air.
Works well and handles multiple bulletins.
When we have bad weather we have lots of data!
I want to get the actual broadcast times and put them in the
log the
shell script generates.
I thought I could make a macro cart which I can put in the log
first,
then put the traffic cart in so they play in sequence, the macro
cart
outputting time of day.
I have thought of using Now & Next to somehow get data when
that
unique cart plays.
Monitoring port 5860 and pulling in the data is something I can
manage.
But the how to generate the data in the first place is causing
acute
brain fade.
Someone will have done this somewhere for something else.
regards
Robert Jeffares
_______________________________________________
Rivendell-dev mailing list
[email protected] [1]
http://caspian.paravelsystems.com/mailman/listinfo/rivendell-dev
[2]
--
COMMUNICATION CONSULTANTS
64 Warner Park Avenue
Laingholm
Auckland 0604
09 8176358
0221693124
06 650 6087
Links:
------
[1] mailto:[email protected]
[2] http://caspian.paravelsystems.com/mailman/listinfo/rivendell-dev
_______________________________________________
Rivendell-dev mailing list
[email protected]
http://caspian.paravelsystems.com/mailman/listinfo/rivendell-dev