So following this thread, I spent the weekend writing just this. What I've done
is put special voicetrack markers in the log, created a group for just the
liners and tied each liner to a particular music cart so it will only get
inserted in front of that cart (this is for "power intros" and other similar
presentation. The script in PHP is below if it's of use to anyone. Please tell
me if what I'm doing (rewriting the LOG table on the fly is even crazier than I
think it is). :-)
Jonathan
<?php
//
//
// Broadcast Management Rivendell Log Power Introifier. Original release date
2018-07-15.
// Copyright 2018 Jonathan Cohen. Version 1.00 updated 2018-07-15.
// More info: www.radiotools.uk or for commercial support
www.broadcast.management.
//
//
// This script replaces special voice-track markers with power-intros or
station liners.
//
// IMPORTANT: PLEASE ENSURE YOU HAVE A FULL BACKUP OF YOUR RIVENDELL SYSTEM
BEFORE ATTEMPTING TO USE THIS SCRIPT!
//
// IMPORTANT: This script version is for Rivendell 2.19.2. It might work on
other versions but as this is untested and
// the script talks directly to the database, there is a risk of corruption
if you run this on any other version.
//
//
// How to use:
//
// In RDlogmanager create an event called something like VOICEINTRO. In this,
right click in "pre-imported carts" and
// "Insert Voice Track". Then right click on the Voice Track you inserted and
select "Edit Voice Track". In the "Edit
// Voice Track Marker" box that appears type "VOICE-INTRO" without the
quotes. This must be exactly as typed as we will
// look for that text in the log. Save the event and then add it to any
required clocks, immediatly before any music events
// that need intros or voicetracks.
//
// Create a cart group called IMGINTRO. Add all your intros to this group as
new carts and in the ALBUM field of each intro
// cart, enter the cart number of the related music track you want the intro
to be placed in front of. For example, if MUSIC
// cart 123456 has an IMGINTRO cart of 234567 then in cart 234567 put 123456
in the ALBUM field.
//
// In the appropreate clock, add VOICEINTRO events before any track that
might need a VT or power intro (these will be automatically
// replaced with an intro if one exists, leaving the others for VTing - or
the power intro can be removed and a VT still done).
//
// For "power intros" to music, the "no fade on segue" and segue markers
option can be used to seemlessly transition from the intro to music.
//
// Run the normal log generation within Rivendell either from RDlogmanager or
using a cron script. This will fill your log as normal
// then import any music logs if you use them. Then run this script on the
same log to replace the selections using this system.
//
//
// To run, copy the script to /usr/src then call in this format:
// /usr/bin/php /usr/src/bcpowerintro.php 2018_05_27
// (where 2018_05_27 is the name of the log you want to process).
//
//
//
//
// User settings. You need to configure these for your system:
$servername = "localhost";
$username = "root";
$password = "yourdatabasepassword";
$dbname = "Rivendell";
// Start of main code.
//
//
// Get the argument passed to the script and give an error if no log selected.
//
if ( ! isset($argv[1])) { // Fix for undefined offset error if no argument
passed.
$argv[1] = null;
}
//
$selectedlog=$argv[1];
if ($selectedlog == '' ) {
echo "\nBroadcast Management Rivendell Log Power Introifier.\n";
echo "Copyright 2018 Jonathan Cohen. Version 1.00 Release date
2018-07-15.\n";
echo "More info: www.radiotools.uk or for commercial support
www.broadcast.management.\n\n";
//
echo "ERROR: You need to pass the name of the log to introify to the
script. \n";
echo "For example: php bcpowerintro.php 2018_05_28\n\n";
exit; // Ouch.
}
$logname=$selectedlog;
//
//
//$logname='2018_05_29'; // For debug use to force a log name
//
//
// Extra sanity check for log names. Just in case a really short name is
accidentally entered we don't want it to do something silly.
if (strlen($logname) < 8) {
echo "\n\nERROR: The log name entered (".$logname.") is less than 8
characters. For safety please use log names of 8 or more characters.\n\n";
exit;
}
//
//
$log_selected = $logname.'_LOG'; // Add the prefix Rivendell
uses internally for it's database tables.
echo "\nLog selected: ".$log_selected."\n";
// Create database connection.
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Create database connection.
$conn1 = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn1->connect_error) {
die("Connection failed: " . $conn1->connect_error);
}
// Create database connection.
$conn2 = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn2->connect_error) {
die("Connection failed: " . $conn2->connect_error);
}
// Create database connection.
$conn3 = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn3->connect_error) {
die("Connection failed: " . $conn3->connect_error);
}
// Work through the days log.
$count_replacements=0; // Keep a count of how many were changed for
display at the end.
//
$sql = "SELECT * FROM ".$log_selected." ORDER BY ID ASC";
$result = $conn->query($sql);
//
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
$ret_ID = $row['ID'];
$ret_TYPE = $row['TYPE'];
$ret_SOURCE = $row['SOURCE'];
$ret_CART_NUMBER = $row['CART_NUMBER'];
$ret_COMMENT = $row['COMMENT'];
//
//echo "Logline ID: ".$ret_ID." - CartID: ".$ret_CART_NUMBER." - ".$ret_TYPE."
- ".$ret_SOURCE." - ".$ret_COMMENT."\n"; // Show the current line of the log
//
if ($ret_TYPE=='6' && $ret_SOURCE=='3' && $ret_COMMENT=='VOICE-INTRO') {
// We have a VOICE-INTRO event!
echo "------------\nFound VOICE-INTRO line ID: ".$ret_ID." - CartID:
".$ret_CART_NUMBER." - ".$ret_TYPE." - ".$ret_SOURCE." - ".$ret_COMMENT."\n";
// Show the current line of the log
//
// Let's get the next log ID line to find out if it's a MUSIC cart and
if so, if it has an intro we should use!
$newid=$ret_ID+1;
echo "Attempting to retreve next line :".$newid."\n";
// Retreve the next line using a seperate database connection so we
don't mess up the current loop.
$sql1 = "SELECT * FROM ".$log_selected." WHERE ID='".$newid."'";
$result1 = $conn1->query($sql1);
while($row1 = $result1->fetch_assoc()) {
$ret_ID1 = $row1['ID'];
$ret_TYPE1 = $row1['TYPE'];
$ret_SOURCE1 = $row1['SOURCE'];
$ret_CART_NUMBER1 = $row1['CART_NUMBER'];
$ret_COMMENT1 = $row1['COMMENT'];
}
echo "Next line ID: ".$ret_ID1." - CartID: ".$ret_CART_NUMBER1." -
".$ret_TYPE1." - ".$ret_SOURCE1." - ".$ret_COMMENT1."\n";
// if the $ret_CART_NUMBER1 length is >4 then we should have a valid
card number so we look this up.
if (strlen($ret_CART_NUMBER1) > 4){
// This looks like a valid cart number
echo "Next cart number ".$ret_CART_NUMBER1." looks valid.\n";
// Now we have the number of the next cart, we need to see if it
matches the ALBUM field of any of our IMGINTRO carts.
$sql2 = "SELECT * FROM CART WHERE ALBUM='".$ret_CART_NUMBER1."'";
$result2 = $conn1->query($sql2);
// Reset variables to ensure no accidental repeats.
$ret_NUMBER='';
$ret_ARTIST='';
$ret_TITLE='';
while($row2 = $result2->fetch_assoc()) {
$ret_NUMBER = $row2['NUMBER'];
$ret_ARTIST = $row2['ARTIST'];
$ret_TITLE = $row2['TITLE'];
}
if ($ret_NUMBER != '') {
// We appear to have a valid intro cart!
echo "**** Found intro cart as ALBUM in IMGINTRO:
".$ret_NUMBER.". ****\n";
$count_replacements=$count_replacements+1; // Keep a count
for display later.
// Now we need to replace the current voicetrack cart with this
$ret_NUMBER.
echo "Intro cart found: ".$ret_NUMBER." - ".$ret_ARTIST." -
".$ret_TITLE."\n";
echo "Replacing log entry ID: ".$ret_ID." with
CART_NUMBER=".$ret_NUMBER.", TYPE=0, SOURCE=2, COMMENT=Broadcast.\n";
//
$sql2 = "UPDATE ".$log_selected." SET
CART_NUMBER=".$ret_NUMBER.", TYPE=0, SOURCE=2, COMMENT='Broadcast' WHERE
ID=".$ret_ID;
$result2 = $conn1->query($sql2);
//
}
}
}
}
} else {
echo "ERROR: No entries in log!";
}
$conn->close();
echo "\nTotal changed: ".$count_replacements."\n\n";
?>
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Patrick
Sent: 12 July 2018 19:41
To: [email protected]
Subject: Re: [RDD] Substitute Voice Track If Missing
Brian, I’ve been wanting the same thing. I was thinking of writing a RLM to do
it. It would look at the next thing in the log and replace an empty voice track
with a cart that contains liners.
I don’t know if there’s a better way to accomplish the same thing.
Patrick
Sent from my iPhone
> On Jul 12, 2018, at 9:39 AM, [email protected] wrote:
>
> Hello,
>
> I have a unique situation whereby we have numerous student volunteers
> who do airshifts. Sometimes they fail to show up for their shift,
> leaving the Program Director to scramble.
>
> To alleviate some of the load on the PD, I'd like to figure out a way to
> substitute a liner or similar content if a voicetrack is missing. For
> example, if we have three or four announcer breaks an hour and the jock
> doesn't show up, I'd like the automation to pop a liner in there without
> needing human intervention.
>
> I'm new enough to Rivendell that I think there's a way to do it but I
> don't quite have the knowledge to make it happen or the vocabulary to
> adequately search for an answer either. Maybe a macro?
>
> Steve
> _______________________________________________
> Rivendell-dev mailing list
> [email protected]
> http://caspian.paravelsystems.com/mailman/listinfo/rivendell-dev
>
_______________________________________________
Rivendell-dev mailing list
[email protected]
http://caspian.paravelsystems.com/mailman/listinfo/rivendell-dev
_______________________________________________
Rivendell-dev mailing list
[email protected]
http://caspian.paravelsystems.com/mailman/listinfo/rivendell-dev