Follow

Live365 - PAL Script to play three, 90-second adverts per hour

For customers using Live365 who need to play four minutes of adverts per hour, we have created a number of PAL scripts which can easily facilitate this.

Firstly, you should download the files Live365 will replace with live adverts, these are available here:

https://support.live365.com/hc/en-us/articles/115003833727-Live-DJ-Ad-triggers

You should download these files, unzip them and add them to your SAM Broadcaster library.  For this script to work, you should create a playlist entitled 'Live365-90' and drop all of the tracks from the 90.zip file into this playlist.  You should also ensure these tracks are categorized as adverts.  To achieve this, right-click on each track, select Song Info and ensure the Type is set to A.

Follow the instructions in this Help Center guide to create a new PAL Script.  If you are planning on using different advert options, you might want to give this PAL script a meaningful name to help identify the script, for example, 'Live365-90.pal'.

Once you have created the PAL script, copy and paste this code into the script and don't forget to save the script:


{**********************************************************************

                Live365 90-Second Advert Script
              
 PAL Script to play three 90-Second Adverts for Live365 Broadcasters
  This will only work when the adverts provided by Live365 are added
      to a Playlist entitled Live365-90 and categorized as Adverts

  One, 90-second advert will be added to the top of the queue at the
      following numbers of minutes past the hour: 10, 30 & 50

    Live365 customers must include 4 minutes of adverts each hour
 
No support is provided with this script which is used at your own risk

**********************************************************************}

PAL.Loop := True;                              // Loop the PAL Script

// Variable Declarations **************************************************************************
var Player1 : TPlayer;                         // Declare an instance of TPlayer for the Active Player
var Player2 : TPlayer = DeckB;                 // Declare an instance of TPlayer for the Idle Player

var CountRep : integer;
var AdBreakTotal : integer;
var AdCount : integer;                         // Used to count the number of adverts
var P1Track, P2Track, P3Track : TSongInfo;     // Declare the TSongInfo Containers
// End Of Variable Declarations ********************************************************************

// Declare Adjustable Variables ********************************************************************
CountRep := 1;
var AdTotal : integer = 1;                     // Set the number of adverts to play
// End Of Declare Adjustable Variables **************************************************************

While Countrep <4 do
  begin
    case CountRep of
      1 : PAL.WaitForTime ('XX:10:00');
      2 : PAL.WaitForTime ('XX:30:00');
      3 : PAL.WaitForTime ('XX:50:00');
      end;
    CountRep := CountRep + 1;

    PAL.LockExecution;                         // Speed up the Script processing

    // Check for the Active Player
    Player1 := ActivePlayer;                   // Assign the Active Player to Player1
    If Player1 = DeckB Then Player2 := DeckA;  // Assign the Idle Player to Player 2

    // Add the required number of adverts to the top of the queue
    for AdCount := 1 to AdTotal do
      begin
      CAT['Live365-90'].QueueTop(smLRP,NoRules);
      writeln(AdCount);
    end;

    // Capture the Track Information from the Active Player
    P3Track := ActivePlayer.GetSongInfo;

    // Count the Adverts
    while (AdCount < AdTotal) AND (P3Track['songtype'] <> 'S') do
      begin
      PAL.WaitForPlayCount(1);                 // Wait for the Advert to Play
      P3Track := ActivePlayer.GetSongInfo;     // Capture the next Track Information
      end;                                     // end for the While loop

    PAL.UnLockExecution;                       // Return PAL Script processing to normal speed
    end;

// Housekeeping
Player1.Free;
Player2.Free;
P1Track.Free;
P2Track.Free;
P3Track.Free;


 

The PAL script is also available to download below.  This script will actually play 4 minutes and 30 seconds of adverts because of the 90 second advert length.

If you would like to adjust the times that the adverts are added to the queue then you should alter the minutes in this section:

      1 : PAL.WaitForTime ('XX:10:00');
      2 : PAL.WaitForTime ('XX:30:00');
      3 : PAL.WaitForTime ('XX:50:00');

 This PAL script is offered as-is and no support can be provided.  Whilst this script has been thoroughly tested, use of this script is at your own risk.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments