Difference between revisions of "How to setup a rotation of fill in logs that can be loaded via a macro"
From Rivendell Wiki
(Created page with "'''Q:''' Here at our station we allow presenters to load music manually, advertising is scheduled by traffic program on a separate log Aux1. There are occasions, especially in...")
Latest revision as of 15:53, 12 March 2018
Q: Here at our station we allow presenters to load music manually, advertising is scheduled by traffic program on a separate log Aux1. There are occasions, especially in the middle of the night when presenters do not show up. I have created a sound panel button activating a macro to load a music log in the Main log to give us at least 6 hours worth of continues music.
My question is, does anyone know of a way that you can create say a number of logs and use a macro to load these in rotation similar to what we do with cut in carts?
A: I am guessing you are using the LL 1 logname! command on your button. I don't know of a way inside Rivendell but since there is a command to run a shell command, RN, you could do this externally then use a rmlsend command to load the log chosen.
Save the script below and make it executable. Then make a text in the same directory called loglist.txt with it listing your log names one per line.
Then set your button to fire:
Replace path to the file with the real path to the script.
This script will rotate by randomly picking a log through the list of logs and then after having used them all will start over again through the list. It will also keep a log of what logs were loaded when in loglog.txt.
You must set the path to the place where you will store the files or when Rivendell runs the macro it will hang the script. This is done with the variable at the beginning PATH2FILES. PATH2FILES must end with a /. You can change the names of the other files to suit your liking by changing the variables at the top of the script.
#!/bin/bash set -x PATH2FILES=/home/rduser/ LOGLIST=loglist.txt LOGCART=logcart.txt LOGSSTARTEDLOG=loglog.txt TMPDATA="$PATH2FILES"tmp.dat LOGLIST=$PATH2FILES$LOGLIST LOGCART=$PATH2FILES$LOGCART LOGSSTARTEDLOG=$PATH2FILES$LOGSSTARTEDLOG if [ ! -e $LOGCART ]; then cp $LOGLIST $LOGCART fi RAND=$(od -d -N2 -An /dev/urandom) LINES=$(cat "$LOGCART" | wc -l) if [ $LINES -eq 0 ]; then cp $LOGLIST $LOGCART fi LINE=$(( RAND % LINES + 1 )) CHOICE=$(head -$LINE $LOGCART | tail -1) PLAYEDCHOICE=$(sed -n /$CHOICE/p playedlogs.txt 2>/dev/null) sed /$CHOICE/d $LOGCART >$TMPDATA cp $TMPDATA $LOGCART rm $TMPDATA if [ $LINES -eq 1 ]; then rm $LOGCART fi rmlsend LL\ 1\ $CHOICE\! NOW=$(date) echo "Log $CHOICE loaded on " $NOW >>$LOGSSTARTEDLOG
log1 log2 log3 log4 log5 log6 log7 log8 log9 log10