[RDD] Confirming a cart has been played to an external log

Robert Jeffares jeffares.robert at gmail.com
Tue Jul 12 17:50:22 EDT 2016

Thanks Wayne,
just the nudge I needed to take an alternate look.

I set up a UDP RLM like this

FormatString=CART=%n BCTIME=%d(hh:mm)\n

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

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.


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=
> UdpPort=5860
> FormatString=CART=%n\nTITLE=%t\nARTIST=%a\nALBUM=%l\nMS=%h\n
> 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=%n\n
> 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
> Rivendell-dev at lists.rivendellaudio.org
> http://caspian.paravelsystems.com/mailman/listinfo/rivendell-dev

*Communication Consultants*
64 Warner Park Avenue


Auckland 0604

09 8176358


06 650 6087
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://caspian.paravelsystems.com/pipermail/rivendell-dev/attachments/20160713/9f95d33b/attachment.html>

More information about the Rivendell-dev mailing list