This is a couple of weeks after the last post here - but I can offer a different solution to allowing your remote DJs access to stop and start the encoders on the main broadcast server.
This assumes that you have some sort of web space for your station, and are using a MySQL database. If you're using Firebird, you can probably still do it. Just please don't ask me how.
On a different station for which I used to work, the owner/creator of the station wanted to have the remote DJs able to stop the server encoders for long enough that they could connect to the server with their own personal version of SAM, then do their show. After it was over, they would simply drop their connection and the "central" server would pick up within a second or two. How he did it:
- Added a new table to the samdb database called 'encoders'
- Added a column to that table called 'updown' - a numeric/boolean field that will take only 0 or 1 values
- Created a PAL script that ran all the time that looked like this:
(!empty($user->lang['CODE'])) ? $user->lang['CODE'] : ucwords(strtolower(str_replace('_', ' ', 'CODE'))):
PAL.Loop := TRUE;
PAL.LockExecution;
var result, pstatus : Integer;
var D : TDataSet;
var enc : String;
var resetQuery : String;
resetQuery := 'UPDATE encoders set encode=0';
// use SQL query to check encode=1 or 0, which will be acted on later
// if encode=2, stop all encoders, then wait for one minute and start them again
D := Query('SELECT encode from encoders', [], True);
result := D['encode'];
enc := IntToStr(result);
IF (enc = '2') then
// WriteLn('Encoders would be stopped here');
// Player.FadeToNext;
Encoders.StopAll();
IF (enc = '1') then
// WriteLn('Encoder 1 would be started here');
Encoders[0].Start();
IF (enc = '1') then
// WriteLn('Encoder 2 would be started here');
Encoders[1].Start();
IF ((enc = '2') OR (enc = '1')) then
PAL.WaitForTime('+00:01:00');
IF (enc = '2') then
// WriteLn('Encoder 1 would be started here');
Encoders[0].Start();
IF (enc = '2') then
// WriteLn('Encoder 2 would be started here');
Encoders[1].Start();
// reset encode back to 0
IF ((enc = '2') OR (enc = '1')) then
ExecSQL(resetQuery, []);
PAL.UnlockExecution;
(I left all of his comments, debug hooks, etc. intact)
- Next, he created a very simple PHP page containing two radio buttons: to shut off, or start the encoders. It should be OBVIOUS, but definitely put this page behind a VERY strong password to keep assholes from getting at it.
When shut off was clicked, it flipped the 'updown' value to 1 from the usual 0 - for 60 seconds. It would take far less time than that for the live DJ to connect their own encoders to the server. After a minute, the 'updown' value was flipped back, and the encoders on the main server would continue to try to connect until the live DJ's show was over and they dropped their connection - at which time the main server would pick right back up. Here is the PHP code for that:
(!empty($user->lang['CODE'])) ? $user->lang['CODE'] : ucwords(strtolower(str_replace('_', ' ', 'CODE'))):
<?php
include "../connect.sql.php";
//AFTER THE FORM HAS BEEN SUBMITTED
$stage = $_GET['stage'];
if($stage == "2")
{
$encode = $_POST['encode'];
}
if($encode == "1") {
echo "Encoders started.";
$query = "UPDATE encoders SET encode =$encode";
$result = mysql_query($query);
}
if($encode == "2") {
echo'
Encoders stopped!<br>
There is no need to go back and restart the encoders, as they will restart themselves in 60 seconds.<br>
';
$query = "UPDATE encoders SET encode =$encode";
$result = mysql_query($query);
$enrquery = "UPDATE encoders SET reqform=1";
$res2 = mysql_query($enrquery);
}
else {
//THE FORM!
echo'
<form method=post action="encoders.php?stage=2">
<B>Start and Stop Certain Encoders...</B><br />
<input type="radio" value="1" name="encode">Start All Encoders<br>
<input type="radio" value="2" name="encode">Stop All Encoders<br>
<input type=submit value="<< Proceed >>"></form>';
};
?>
I hope this is clear enough for those of you who grok this sort of thing better than I. I didn't know what Meatwad from HCR was talking about half the time, I just nodded my head and said 'uh huh'.
