DJ Management Script

I present to you the script I wrote to take care of Live DJs in Sam. There are a number of different ways this could be done. If you wish to do it differently or port it to a language other than PHP, go for it (just be sure to share).

Before switching from Auto DJ to the specified Live DJ the script checks that the Live DJ is actually on the air. If the Live DJ is on the air, the Auto DJ fades to the Live DJ. If the Live DJ is not on the air when he is supposed to be, nothing happens. If the Live DJ drops the stream, the scripts switches back to the Auto DJ and rechecks every 2 seconds to see if the Live DJ has returned. If the Live DJ returns, we switch back to him.

Known issues:
* If schedule.php is inaccessible or doesn’t return the expected number of lines, Sam will crash.
* If current.txt or past.txt are inaccessible or don’t return the expected number of lines, Sam will crash.

dj.pal:

{DJ Management Pal by Nathan Skelton
Updates available at http://hostify.net/blog}
PAL.Loop := True;
 
PAL.LockExecution;
{Set up our Variables}
Var Url : String = 'null';
Var Port : String = 'null';
Var DJ : String = 'null';
Var Main_status : String = 'null';
Var Main_artist : String = 'null';
Var Main_song : String = 'null';
Var DJ_status : String = 'null';
Var DJ_artist : String = 'null';
Var DJ_song : String = 'null';
Var Main_song_full : String = 'null';
Var DJ_song_full : String = 'null';
Var Past_URL : String = 'null';
Var Scheduled : TStringList; Scheduled := TStringList.Create;
Var Past : TStringList; Past := TStringList.Create;
Var rSong : TSongInfo; rSong := ActivePlayer.GetSongInfo;
 
{this is the working directory for the script
current.txt and past.txt must exist in this directory and be writable by Sam}
Var Dir : String = 'C:\Users\Administrator\Desktop\DJ';
 
{grab the now playing and dj info from the server}
WebToFile(Dir + 'current.txt','http://localhost/DJ/schedule.php');
 
{if we grabbed the file successfully}
if FileExists(Dir + 'current.txt') then
begin
  Scheduled.LoadFromFile(Dir + 'current.txt');
 
  {load up the results from the last round}
  if FileExists(Dir + 'past.txt') then
  begin
    Past.LoadFromFile(Dir + 'past.txt');
    Past_URL := Past[0] + ':' + Past[1];
  end;
 
  {pull the variables from the file}
  Url := Scheduled[0];
  Port := Scheduled[1];
  DJ := Scheduled[2];
  Main_status := Scheduled[3];
  Main_artist := Scheduled[4];
  Main_song := Scheduled[5];
  Main_song_full := Main_artist + ' - ' + Main_song;
  DJ_status := Scheduled[6];
  DJ_artist := Scheduled[7];
  DJ_song := Scheduled[8] + ' ' + DJ;
  DJ_song_full := DJ_artist + ' - ' + DJ_song;
 
  {rename our current file so it will be fresh on our next loop}
  CopyFile(Dir + 'current.txt', Dir + 'past.txt', false);
end;
 
{If the DJ is null, there is no DJ scheduled for right now}
if (DJ <> 'null') then
begin
  WriteLn('The Current DJ is ' + DJ + ' On ' + Url + ':' + Port);
 
  {if the DJ is not currently loaded in the playing deck...}
  if (rSong['title'] <> Url + ':' + Port) then
  begin
    {if the DJ's server status is good, they should be put live...else, we do nothing}
    if (DJ_status='1') then
    begin
      Queue.AddURL(URL + ':' + Port,ipTop);
      ActivePlayer.FadeToNext;
      WriteLn('Switching to Live DJ');
 
      {var Song : TSongInfo;
      Song := TSongInfo.Create;
      Song['artist'] := DJ_song;
      Song['title'] := '';
      Encoders.SongChange(Song);
      Song.Free;
      WriteLn('Song Updated to ' + DJ_song);}
    end;
    if (DJ_status<>'1') then
    begin
      WriteLn('Live DJ not active');
    end;
  end;
 
  {if the DJ is currently loaded in the playing deck...}
  if (rSong['title'] = Url + ':' + Port) then
  begin
    {if the DJ is live}
    if (DJ_status='1') then
    begin
      {if the song on the streaming server doesn't match what is on the DJ server}
      if (Main_song_full <> DJ_song_full) then
      begin
        {we're assuming that the server doesn't care about a seperate artist and title}
        var Song : TSongInfo;
        Song := TSongInfo.Create;
        Song['artist'] := DJ_artist;
        Song['title'] := DJ_song;
        Encoders.SongChange(Song);
        Song.Free;
        WriteLn('Song Updated to ' + DJ_song_full);
      end;
    end;
 
    {if the DJ is currently loaded in the deck, but the DJ server is inactive}
    if (DJ_status<>'1') then
    begin
      ActivePlayer.FadeToNext;
      WriteLn('Live DJ not present. Switching to Auto DJ');
    end;
  end;
end;
 
{if there is no DJ scheduled}
if (DJ = 'null') then
begin
  {if the song title is still set to the past DJ, we need to fade to next}
  if (rSong['title'] = Past_URL) then
  begin
    ActivePlayer.FadeToNext;
    WriteLn('DJ no longer present. Switching to AutoDJ');
  end;
end;
 
rSong.Free;
Past.Free;
Scheduled.Free;
PAL.UnlockExecution;
PAL.WaitForTime('+00:00:02');

schedule.php:

/*
DJ Management Pal by Nathan Skelton
Updates available at http://hostify.net/blog
*/
$serv["name"][] = "AudioProbe.net - 192KB/s";     # short nickname of server.
$serv["host"][] = "listen.audioprobe.net";               # host address  # port IP address
$serv["port"][] = 80;                     # port number
$serv["passwd"][] = "pass";                # admin password

/** 
$time is in 24-hour/military format with leading zeros
 
$days are as follows:
	sunday=0
	monday=1
	tuesday=2
	wednesday=3
	thursday=4
	friday=5
	saturday=6
*/
$time=date("H:i", time());
$day=date("w", time());
 
//an example show
//i've given the DJ five minutes of padding on each end
//if you have back-to-back shows, you may not want to do this, however...it may work out okay since in theory there would be a seamless switch between the DJs
//if you wanted to get really creative, you'd put all of this in a database...
//I'm not feeling that creative at this point considering I only have one live show
 
if($day==0 && ($time>="13:55" && $time<="16:05"))
{
	$server='http://localhost';//the server the dj will be connecting to
	$port=8000;//the port of the server the dj will be connection to
	$password="pass";//the password to the admin interface of the server
	$dj='[Aural Pleasure]';//the name of the dj/show that will be appended to the title field
}
else
{
	//no djs scheduled
	$server='null';
	$port='null';
	$password='null';
	$dj='null';
}
 
//if we have a dj scheduled, let's generate some output!
if($dj!='null')
{
	//we will pull the stats from this server
	$count = 1;
 
	//begin pulling stats
	$mysession = curl_init();
	curl_setopt($mysession, CURLOPT_URL, "http://".$serv["host"][$count].":".$serv["port"][$count]."/admin.cgi?mode=viewxml");
	curl_setopt($mysession, CURLOPT_HEADER, false);
	curl_setopt($mysession, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($mysession, CURLOPT_POST, false);
	curl_setopt($mysession, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
	curl_setopt($mysession, CURLOPT_USERPWD, "admin:".$serv["passwd"][$count]);
	curl_setopt($mysession, CURLOPT_FOLLOWLOCATION, true);
	curl_setopt($mysession, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6");
	curl_setopt($mysession, CURLOPT_CONNECTTIMEOUT, 2);
	$xml = curl_exec($mysession);
 
	//the stats from our main streaming server
	$result=xml2array(utf8_decode($xml));
	if(@is_array($result['SHOUTCASTSERVER']))
	{
		$song=split(' - ',$result['SHOUTCASTSERVER']['SONGHISTORY']['SONG'][0]['TITLE']);
		$streamstatus_1=$result['SHOUTCASTSERVER']['STREAMSTATUS'];
	}
	else
	{
		$song[0]='null';
		$song[1]='null';
		$streamstatus_1='null';
	}
 
	//the stats for our dj's server
	curl_setopt($mysession, CURLOPT_URL, $server.":".$port."/admin.cgi?mode=viewxml");
	curl_setopt($mysession, CURLOPT_USERPWD, "admin:".$password);
	$xml2 = curl_exec($mysession);
 
	curl_close($mysession);
 
 
	$result2=xml2array(utf8_decode($xml2));
	if(@is_array($result2['SHOUTCASTSERVER']))
	{
		$oldsong=split(' - ',$result2['SHOUTCASTSERVER']['SONGHISTORY']['SONG'][0]['TITLE']);
		$streamstatus_2=$result2['SHOUTCASTSERVER']['STREAMSTATUS'];
	}
	else
	{
		$oldsong[0]='null';
		$oldsong[1]='null';
		$streamstatus_2='null';
	}
}
else
{
	$song[0]='null';
	$song[1]='null';
	$oldsong[0]='null';
	$oldsong[1]='null';
	$streamstatus_1='null';
	$streamstatus_2='null';
}
 
if(!$song[0])
{
	$song[0]='null';
}
if(!$song[1])
{
	$song[1]='null';
}
if(!$oldsong[0])
{
	$oldsong[0]='null';
}
if(!$oldsong[1])
{
	$oldsong[1]='null';
}
if(!$streamstatus_1)
{
	$streamstatus_1='null';
}
if(!$streamstatus_2)
{
	$streamstatus_2='null';
}
 
echo $server."n".$port."n".$dj."n".$streamstatus_1."n".$song[0]."n".$song[1]."n".$streamstatus_2."n".$oldsong[0]."n".$oldsong[1];
 
/** 
 * xml2array() will convert the given XML text to an array in the XML structure. 
 * Link: http://www.bin-co.com/php/scripts/xml2array/ 
 * Arguments : $contents - The XML text 
 *                $get_attributes - 1 or 0. If this is 1 the function will get the attributes as well as the tag values - this results in a different array structure in the return value.
 *                $priority - Can be 'tag' or 'attribute'. This will change the way the resulting array sturcture. For 'tag', the tags are given more importance.
 * Return: The parsed XML in an array form. Use print_r() to see the resulting array structure. 
 * Examples: $array =  xml2array(file_get_contents('feed.xml')); 
 *              $array =  xml2array(file_get_contents('feed.xml', 1, 'attribute')); 
 */ 
function xml2array($contents, $get_attributes=1, $priority = 'tag') { 
    if(!$contents) return array(); 
 
    if(!function_exists('xml_parser_create')) { 
        //print "'xml_parser_create()' function not found!"; 
        return array(); 
    } 
 
    //Get the XML parser of PHP - PHP must have this module for the parser to work 
    $parser = xml_parser_create(''); 
    xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, "UTF-8"); # http://minutillo.com/steve/weblog/2004/6/17/php-xml-and-character-encodings-a-tale-of-sadness-rage-and-data-loss 
    xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); 
    xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); 
    xml_parse_into_struct($parser, trim($contents), $xml_values); 
    xml_parser_free($parser); 
 
    if(!$xml_values) return;//Hmm... 
 
    //Initializations 
    $xml_array = array(); 
    $parents = array(); 
    $opened_tags = array(); 
    $arr = array(); 
 
    $current = &$xml_array; //Refference 
 
    //Go through the tags. 
    $repeated_tag_index = array();//Multiple tags with same name will be turned into an array 
    foreach($xml_values as $data) { 
        unset($attributes,$value);//Remove existing values, or there will be trouble 
 
        //This command will extract these variables into the foreach scope 
        // tag(string), type(string), level(int), attributes(array). 
        extract($data);//We could use the array by itself, but this cooler. 
 
        $result = array(); 
        $attributes_data = array(); 
 
        if(isset($value)) { 
            if($priority == 'tag') $result = $value; 
            else $result['value'] = $value; //Put the value in a assoc array if we are in the 'Attribute' mode 
        } 
 
        //Set the attributes too. 
        if(isset($attributes) and $get_attributes) { 
            foreach($attributes as $attr => $val) { 
                if($priority == 'tag') $attributes_data[$attr] = $val; 
                else $result['attr'][$attr] = $val; //Set all the attributes in a array called 'attr' 
            } 
        } 
 
        //See tag status and do the needed. 
        if($type == "open") {//The starting of the tag '<tag>' 
            $parent[$level-1] = &$current; 
            if(!is_array($current) or (!in_array($tag, array_keys($current)))) { //Insert New tag 
 
 
                $current[$tag] = $result; 
                if($attributes_data) $current[$tag. '_attr'] = $attributes_data; 
                $repeated_tag_index[$tag.'_'.$level] = 1; 
 
                $current = &$current[$tag]; 
 
            } else { //There was another element with the same tag name 
 
                if(isset($current[$tag][0])) {//If there is a 0th element it is already an array 
                    $current[$tag][$repeated_tag_index[$tag.'_'.$level]] = $result; 
                    $repeated_tag_index[$tag.'_'.$level]++; 
                } else {//This section will make the value an array if multiple tags with the same name appear together
                    $current[$tag] = array($current[$tag],$result);//This will combine the existing item and the new item together to make an array
                    $repeated_tag_index[$tag.'_'.$level] = 2; 
 
                    if(isset($current[$tag.'_attr'])) { //The attribute of the last(0th) tag must be moved as well 
                        $current[$tag]['0_attr'] = $current[$tag.'_attr']; 
                        unset($current[$tag.'_attr']); 
                    } 
 
                } 
                $last_item_index = $repeated_tag_index[$tag.'_'.$level]-1; 
                $current = &$current[$tag][$last_item_index]; 
            } 
 
        } elseif($type == "complete") { //Tags that ends in 1 line '<tag />' 
            //See if the key is already taken. 
            if(!isset($current[$tag])) { //New Key 
                $current[$tag] = $result; 
                $repeated_tag_index[$tag.'_'.$level] = 1; 
                if($priority == 'tag' and $attributes_data) $current[$tag. '_attr'] = $attributes_data; 
 
            } else { //If taken, put all things inside a list(array) 
                if(isset($current[$tag][0]) and is_array($current[$tag])) {//If it is already an array... 
 
                    // ...push the new element into that array. 
                    $current[$tag][$repeated_tag_index[$tag.'_'.$level]] = $result; 
 
                    if($priority == 'tag' and $get_attributes and $attributes_data) { 
                        $current[$tag][$repeated_tag_index[$tag.'_'.$level] . '_attr'] = $attributes_data; 
                    } 
                    $repeated_tag_index[$tag.'_'.$level]++; 
 
                } else { //If it is not an array... 
                    $current[$tag] = array($current[$tag],$result); //...Make it an array using using the existing value and the new value
                    $repeated_tag_index[$tag.'_'.$level] = 1; 
                    if($priority == 'tag' and $get_attributes) { 
                        if(isset($current[$tag.'_attr'])) { //The attribute of the last(0th) tag must be moved as well
 
                            $current[$tag]['0_attr'] = $current[$tag.'_attr']; 
                            unset($current[$tag.'_attr']); 
                        } 
 
                        if($attributes_data) { 
                            $current[$tag][$repeated_tag_index[$tag.'_'.$level] . '_attr'] = $attributes_data; 
                        } 
                    } 
                    $repeated_tag_index[$tag.'_'.$level]++; //0 and 1 index is already taken 
                } 
            } 
 
        } elseif($type == 'close') { //End of tag '</tag>' 
            $current = &$parent[$level-1]; 
        } 
    } 
 
    return($xml_array); 
}

current.txt, past.txt:

http://localhost
8000
[Aural Pleasure]
1
The Crystal Method
Slipstream (feat. Jason Lytle) [Aural Pleasure]
1
The Crystal Method
Slipstream (feat. Jason Lytle)
  • Do not work!

    All the php page says is NALL NALL NALL NALL
    Did I miss something or put something in a wrong place?
    I put the dj.pal in sam and it seems to work it keeps looking for a live DJ.
    I guess I am not sure what to do with the dj.php

    • admin

      If the output from schedule.php is “null null null null null null null null null” then a DJ is not currently scheduled. You can schedule a DJ by modifying the example in schedule.php.

      dj.pal calls schedule.php roughly every two seconds to determine if a DJ is scheduled. If a DJ is not scheduled, the pal script does nothing. If a DJ is scheduled, it checks to see if the server is live and switches over. The pal script doesn’t output anything unless schedule.php indicates that a DJ is currently scheduled.

      Does this help at all?

      • I cant find where to change the DJs schedule
        We have more then one live show and one auto DJ.

        here is what I have for the php page:

        name = “Power Jammin’ Radio”; # short nickname of server.
        $serv->host = “panel1.shoutcast.pro”; # host address # port IP address
        $serv ->port = “8060”; # port number
        $serv ->passwd = “snip”; # admin password

        /**
        $time is in 24-hour/military format with leading zeros

        $days are as follows:
        sunday=0
        monday=1
        tuesday=2
        wednesday=3
        thursday=4
        friday=5
        saturday=6
        */
        $time=date(“H:i”, time());
        $day=date(“w”, time());

        //an example show
        //i’ve given the DJ five minutes of padding on each end
        //if you have back-to-back shows, you may not want to do this, however…it may work out okay since in theory there would be a seamless switch between the DJs
        //if you wanted to get really creative, you’d put all of this in a database…
        //I’m not feeling that creative at this point considering I only have one live show

        if($day==0 && ($time>=”13:55″ && $time $val) {
        if($priority == ‘tag’) $attributes_data[$attr] = $val;
        else $result[‘attr’][$attr] = $val; //Set all the attributes in a array called ‘attr’
        }
        }

        //See tag status and do the needed.
        if($type == “open”) {//The starting of the tag ”
        $parent[$level-1] = &$current;
        if(!is_array($current) or (!in_array($tag, array_keys($current)))) { //Insert New tag

        $current[$tag] = $result;
        if($attributes_data) $current[$tag. ‘_attr’] = $attributes_data;
        $repeated_tag_index[$tag.’_’.$level] = 1;

        $current = &$current[$tag];

        } else { //There was another element with the same tag name

        if(isset($current[$tag][0])) {//If there is a 0th element it is already an array
        $current[$tag][$repeated_tag_index[$tag.’_’.$level]] = $result;
        $repeated_tag_index[$tag.’_’.$level]++;
        } else {//This section will make the value an array if multiple tags with the same name appear together
        $current[$tag] = array($current[$tag],$result);//This will combine the existing item and the new item together to make an array
        $repeated_tag_index[$tag.’_’.$level] = 2;

        if(isset($current[$tag.’_attr’])) { //The attribute of the last(0th) tag must be moved as well
        $current[$tag][‘0_attr’] = $current[$tag.’_attr’];
        unset($current[$tag.’_attr’]);
        }

        }
        $last_item_index = $repeated_tag_index[$tag.’_’.$level]-1;
        $current = &$current[$tag][$last_item_index];
        }

        } elseif($type == “complete”) { //Tags that ends in 1 line ”
        //See if the key is already taken.
        if(!isset($current[$tag])) { //New Key
        $current[$tag] = $result;
        $repeated_tag_index[$tag.’_’.$level] = 1;
        if($priority == ‘tag’ and $attributes_data) $current[$tag. ‘_attr’] = $attributes_data;

        } else { //If taken, put all things inside a list(array)
        if(isset($current[$tag][0]) and is_array($current[$tag])) {//If it is already an array…

        // …push the new element into that array.
        $current[$tag][$repeated_tag_index[$tag.’_’.$level]] = $result;

        if($priority == ‘tag’ and $get_attributes and $attributes_data) {
        $current[$tag][$repeated_tag_index[$tag.’_’.$level] . ‘_attr’] = $attributes_data;
        }
        $repeated_tag_index[$tag.’_’.$level]++;

        } else { //If it is not an array…
        $current[$tag] = array($current[$tag],$result); //…Make it an array using using the existing value and the new value
        $repeated_tag_index[$tag.’_’.$level] = 1;
        if($priority == ‘tag’ and $get_attributes) {
        if(isset($current[$tag.’_attr’])) { //The attribute of the last(0th) tag must be moved as well

        $current[$tag][‘0_attr’] = $current[$tag.’_attr’];
        unset($current[$tag.’_attr’]);
        }

        if($attributes_data) {
        $current[$tag][$repeated_tag_index[$tag.’_’.$level] . ‘_attr’] = $attributes_data;
        }
        }
        $repeated_tag_index[$tag.’_’.$level]++; //0 and 1 index is already taken
        }
        }

        } elseif($type == ‘close’) { //End of tag ”
        $current = &$parent[$level-1];
        }
        }

        return($xml_array);
        }
        ?>

        My email is djmike@powerjamminradio.com

        • admin

          Note that you may wish to change the password for your shoutcast server since you included it in your last comment. I have removed it, but there’s no telling if anyone saw it.

          You’re missing some major chunks from the schedule.php file. You may want to get a fresh copy of it. Here is the section where you manage DJs:

          [code]
          if($day==0 && ($time>=”13:55″ && $time< ="16:05")) { $server='http://localhost';//the server the dj will be connecting to $port=8000;//the port of the server the dj will be connection to $password="pass";//the password to the admin interface of the server $dj='[Aural Pleasure]';//the name of the dj/show that will be appended to the title field } elseif($day==1 && ($time>=”12:55″ && $time<="15:05")) { $server='http://localhost';//the server the dj will be connecting to $port=8002;//the port of the server the dj will be connection to $password="pass";//the password to the admin interface of the server $dj='[Some Other Show]';//the name of the dj/show that will be appended to the title field } else { //no djs scheduled $server='null'; $port='null'; $password='null'; $dj='null'; } [/code] You can add more DJs/shows by duplicating the second elseif. I admit this isn't entirely user-friendly. It's something that I put together rather quickly, put into production, and haven't thought of since.

          • Ok I didnt show my password lol

            Ok please tell me if this is right. If not right please tell me. I also am guessing the .pal goes on the auto server and the .php goes onto the FTP with the two txt files right or wrong?

            =”13:55″ && $time $val) {
            if($priority == ‘tag’) $attributes_data[$attr] = $val;
            else $result[‘attr’][$attr] = $val; //Set all the attributes in a array called ‘attr’
            }
            }

            //See tag status and do the needed.
            if($type == “open”) {//The starting of the tag ”
            $parent[$level-1] = &$current;
            if(!is_array($current) or (!in_array($tag, array_keys($current)))) { //Insert New tag

            $current[$tag] = $result;
            if($attributes_data) $current[$tag. ‘_attr’] = $attributes_data;
            $repeated_tag_index[$tag.’_’.$level] = 1;

            $current = &$current[$tag];

            } else { //There was another element with the same tag name

            if(isset($current[$tag][0])) {//If there is a 0th element it is already an array
            $current[$tag][$repeated_tag_index[$tag.’_’.$level]] = $result;
            $repeated_tag_index[$tag.’_’.$level]++;
            } else {//This section will make the value an array if multiple tags with the same name appear together
            $current[$tag] = array($current[$tag],$result);//This will combine the existing item and the new item together to make an array
            $repeated_tag_index[$tag.’_’.$level] = 2;

            if(isset($current[$tag.’_attr’])) { //The attribute of the last(0th) tag must be moved as well
            $current[$tag][‘0_attr’] = $current[$tag.’_attr’];
            unset($current[$tag.’_attr’]);
            }

            }
            $last_item_index = $repeated_tag_index[$tag.’_’.$level]-1;
            $current = &$current[$tag][$last_item_index];
            }

            } elseif($type == “complete”) { //Tags that ends in 1 line ”
            //See if the key is already taken.
            if(!isset($current[$tag])) { //New Key
            $current[$tag] = $result;
            $repeated_tag_index[$tag.’_’.$level] = 1;
            if($priority == ‘tag’ and $attributes_data) $current[$tag. ‘_attr’] = $attributes_data;

            } else { //If taken, put all things inside a list(array)
            if(isset($current[$tag][0]) and is_array($current[$tag])) {//If it is already an array…

            // …push the new element into that array.
            $current[$tag][$repeated_tag_index[$tag.’_’.$level]] = $result;

            if($priority == ‘tag’ and $get_attributes and $attributes_data) {
            $current[$tag][$repeated_tag_index[$tag.’_’.$level] . ‘_attr’] = $attributes_data;
            }
            $repeated_tag_index[$tag.’_’.$level]++;

            } else { //If it is not an array…
            $current[$tag] = array($current[$tag],$result); //…Make it an array using using the existing value and the new value
            $repeated_tag_index[$tag.’_’.$level] = 1;
            if($priority == ‘tag’ and $get_attributes) {
            if(isset($current[$tag.’_attr’])) { //The attribute of the last(0th) tag must be moved as well

            $current[$tag][‘0_attr’] = $current[$tag.’_attr’];
            unset($current[$tag.’_attr’]);
            }

            if($attributes_data) {
            $current[$tag][$repeated_tag_index[$tag.’_’.$level] . ‘_attr’] = $attributes_data;
            }
            }
            $repeated_tag_index[$tag.’_’.$level]++; //0 and 1 index is already taken
            }
            }

            } elseif($type == ‘close’) { //End of tag ”
            $current = &$parent[$level-1];
            }
            }

            return($xml_array);
            }
            ?>

          • admin

            You’re still missing half the script, or perhaps WordPress is filtering it out.

  • *If the output from schedule.php is “null null null null null null null null null” then a DJ is not currently scheduled *

    How do I schedule a dj? Can you give me some examples. Where is your script?

    • admin

      The script you should be using is in the original post. In my second comment I showed how you could modify it to setup a second dj (the first for Sunday 13:55 to 16:05 and the second for Monday 12:55 to 15:05). The text files need to be on the same machine as the PAL script.

  • This script is getting over my head. I did email your webmaster email. I would like to see this thing in action if possible. What do you use this for?

    I will send you the full thing so see if u missed something here.