Sending HTTP Post and Telnet commandoes

Hello,

I work with some radio stations in Norway using mAirlist. They are also using the software Breakaway One for FM brodacast and WEB/HD. In this software it is possible to send HTTP post for changing PI between regional and local + PTY on FM RDS. How can this be scripted in mAirlist to make this changes during the playlist?

Also: 2WCom can change dataset on the RDS with telnet code DSN=1 etc. How can this scripting look like?

Kind regards
Eivind Engberg

Is this actually an HTTP POST call you have to make, or rather HTTP GET? If these links in the screenshot are clickable links that change the PTY, it appears to be GET. That would be very simple in a script:

HTTPGet('http://localhost:8282/parameter/fm1/misc/rds_pty_code=1');

Then for telnet, this function will connect via TCP to the specified IP/port, send the specified string, then disconnect again:

TCPSendString('10.0.0.1', 1234, 'DSN=1');

You would typically wrap these commands in a background scripts so they are triggered when a specific item is started.

Thanks for your fast answer, if you see how it looks like on the PI settings here:

But how do I add this script in the database via the remote interface?

Tried to make a MLS- script - but even when adding it under “playback” → actions on start, nothing happend for the action.

My advise is to decouple the script functionality from the actual item in the library/scheduling, by using a background script that waits for items with specific “characteristics” being played.

For example, this script would execute code whenever an item with the title “News” is played:

procedure OnItemStart(Item: IPlaylistItem; Region: byte; OnAir: boolean; UniqueID: string);
begin
  // And item with the title "News" is started
  if Item.GetTitle = 'News' then begin
    // Insert code here
  end;
end;

Or here is an alternative version that will wait for items of type News:

procedure OnItemStart(Item: IPlaylistItem; Region: byte; OnAir: boolean; UniqueID: string);
begin
  // An item of type "News" is started
  if Item.GetItemType = pitNews then begin
    // Insert code here
  end;
end;

Save as *.mls and register as a background script in the configuration of the playout computer.

Then you only need to take care that the items in your playlist/library have the correct title or type set.

Check out the Background Script Template.mls file in the program folder, there are many more procedures you can use as triggers.

Thank you, I will try this - but when I want to trigger a script when the itemtype is ended, what command do I need to add?

Try this one:

// Called when on-air playback of an item (in any player) ends
procedure OnItemStop(Item: IPlaylistItem; Region: byte; OnAir: boolean; UniqueID: string; Duration: TTimeValue);
begin
end;

All of these can be found in the template file in the program folder.

Still did not do the trick, Just tried this script via Database → Run Script, and then I get error "Error running script: [ERROR] (1:1) Unexpected end of file

I got an error “BEGIN expected” on this script

No, that’s not the correct menu item! That would be for one-shot scripts.

This one is a “background script”, and you have to install it on the playout computer.

So open up the config (or the mAirList Control Panel from the About menu, in case the playout is currently running), go to Background Scripts and add the script there.

Thanks.

I was able to use the script found here:

This script helped me a lot.

But this string:
TCPSendString(‘10.0.0.1’, 1234, ‘DS=1’); need to be ASCll formatted. But seem to be UTF-8. It is the same way to post artist / title to 2WCom RDS encoders as ASCII.

I also need to the script to load with procedure OnOnAir and OnOffAir. The purpose is to send commands when the player is in On Air mode and Off.

// Called when mAirList goes ON AIR

procedure OnOnAir;

begin

HTTPGet('http://' + BREAKAWAY_IP + ':8282/parameter/fm1/misc/rds_pi_hex=F288'); // PI NASJONAL 
TCPSendString('10.0.0.121', 5500, 'DS=2'); // PI NASJONAL  2WCOM < THIS NEED TO BE ASCII

end;

// Called when mAirList goes OFF AIR

procedure OnOffAir;

begin
HTTPGet(‘http://’ + BREAKAWAY_IP + ‘:8282/parameter/fm1/misc/rds_pi_hex=F688’); // PI REGIONAL PI
TCPSendString(‘10.0.0.121’, 5500, ‘DS=1’); // PI REG 2WCOM -< THIS NEED TO BE ASCII

end;

ASCII and UTF-8 is the same thing as long as no special characters are involved.

Maybe you need to terminate the command with a carriage return character? Like pressing Return in a telnet session?

TCPSendString('10.0.0.121', 5500, 'DS=2' + #13);

Just one another question:

If I want to trigger this script when Region playlist (via sub playlist goes onair and starts working, how should I start the script with OnPlayerStart. What defines the Sub playlist name to trigger this action?

HTTPGet(‘http://’ + BREAKAWAY_IP + ‘:8282/parameter/fm1/misc/rds_pi_hex=F688’); // PI REGIONAL PI

You mean when a “Region Container” item is playing? You can check for its ObjectClassID:

procedure OnItemStart(Item: IPlaylistItem; Region: byte; OnAir: boolean; UniqueID: string);
begin
  // An item of class "RegionContainer" is started
  if Item.GetObjectClassID = 'RegionContainer' then begin
    // Insert code here
  end;
end;

So this mean that “RegionContainer” from this picture will be replaced by “Master Playlist” ?

image

And if I want to trigger on “Station”, what will be the object class for the correct triggering?

image

Isn’t it that each playout is bound to exactly one station?

And how do you plan to merge the regional content into the master playlist anyway? How will it end up in the playout?