This script is for use in combination with BreakawayOne FM and streaming (HD) processing (www.breakawayone.com). You need a license with at least one FM core with RDS option, one HD core and the management option. If you want to use only one or the other you need to remove or comment some lines in the code.
If you add it to the background scripts it automatically updates your RDS RT (radiotext) and/or PS (program service), TA (traffic) and music/speech switch for the FM core. For the HD core it updates the metadata for your stream(s).
You can use the constants to set default values for news, weather, traffic and commercials. There are 2 ‘special’ options:
- If you add a Command item to your playlist with “RDSrt” in the artist field, the value of the title field will be stored and used as RT and stream metadata when a voicetrack plays. This way you can display information about the dj or program name at that moment.
- If you add a Command item to your playlist with “RDSps” in the artist field, the value of the title field will replace the PS. We use this to display “zzzzzZOE” during nighttime instead of “ZOE.FM”
const
RT_DEFAULT = 'Radio Station X - tagline'; // default value
RT_NEWS1 = 'News of '; // value during news (followed by the hour of the day)
RT_NEWS2 = ' hour.'; // value during news (preceded by the hour of the day)
RT_WEATHER = ''; // value during weather
RT_TRAFFIC = ''; // value during traffic
RT_ADVERT = ''; // value during commercials
BREAKAWAY_IP = '127.0.0.1'; // ip of BreakawayOne
procedure OnItemStart(Item: IPlaylistItem; Region: byte; OnAir: boolean; UniqueID: string);
var
ItemType : TPlaylistItemType;
rtMusic : string;
begin
if OnAir = true then begin
ItemType := Item.GetItemType;
if ItemType = pitTraffic then HTTPGet('http://' + BREAKAWAY_IP + ':8282/parameter/fm1/misc/rds_ta=1'); // RDS TA (traffic)
if ItemType = pitMusic then HTTPGet('http://' + BREAKAWAY_IP + ':8282/parameter/fm1/misc/rds_music=1'); // RDS music/speach
if (ItemType = pitVoice) or (ItemType = pitWeather) or (ItemType = pitTraffic) or (ItemType = pitAdvertising) or (ItemType = pitNews) then HTTPGet('http://' + BREAKAWAY_IP + ':8282/parameter/fm1/misc/rds_music=0'); // RDS music/speach
if (ItemType = pitUnknown) or (ItemType = pitTrailer) or (ItemType = pitPromo) or (ItemType = pitStationID) then begin
HTTPGet('http://' + BREAKAWAY_IP + ':8282/parameter/fm1/misc/rds_rt?set=' + URLEncode(RT_DEFAULT));
HTTPGet('http://' + BREAKAWAY_IP + ':8282/parameter/hd1/strm/metadata_strm?set=' + URLEncode(RT_DEFAULT));
end;
if ItemType = pitNews then begin
HTTPGet('http://' + BREAKAWAY_IP + ':8282/parameter/fm1/misc/rds_rt?set=' + URLEncode(RT_NEWS1 + FormatDateTime('h', Time) + RT_NEWS2));
HTTPGet('http://' + BREAKAWAY_IP + ':8282/parameter/hd1/strm/metadata_strm?set=' + URLEncode(RT_NEWS1 + FormatDateTime('h', Time) + RT_NEWS2));
end;
if ItemType = pitWeather then begin
HTTPGet('http://' + BREAKAWAY_IP + ':8282/parameter/fm1/misc/rds_rt?set=' + URLEncode(RT_WEATHER));
HTTPGet('http://' + BREAKAWAY_IP + ':8282/parameter/hd1/strm/metadata_strm?set=' + URLEncode(RT_WEATHER));
end;
if ItemType = pitTraffic then begin
HTTPGet('http://' + BREAKAWAY_IP + ':8282/parameter/fm1/misc/rds_rt?set=' + URLEncode(RT_TRAFFIC));
HTTPGet('http://' + BREAKAWAY_IP + ':8282/parameter/hd1/strm/metadata_strm?set=' + URLEncode(RT_TRAFFIC));
end;
if ItemType = pitAdvertising then begin
HTTPGet('http://' + BREAKAWAY_IP + ':8282/parameter/fm1/misc/rds_rt?set=' + URLEncode(RT_ADVERT));
HTTPGet('http://' + BREAKAWAY_IP + ':8282/parameter/hd1/strm/metadata_strm?set=' + URLEncode(RT_ADVERT));
end;
if ItemType = pitVoice then begin
HTTPGet('http://' + BREAKAWAY_IP + ':8282/parameter/fm1/misc/rds_rt?set=' + URLEncode(GetRunTimeData('CurrentProgram')));
HTTPGet('http://' + BREAKAWAY_IP + ':8282/parameter/hd1/strm/metadata_strm?set=' + URLEncode(GetRunTimeData('CurrentProgram')));
end;
if ItemType = pitMusic then begin
rtMusic := Item.GetArtist + ' - ' + Item.GetTitle + ' (' + Item.GetAttributes.GetValue('Jaar') + ')';
HTTPGet('http://' + BREAKAWAY_IP + ':8282/parameter/fm1/misc/rds_rt?set=' + URLEncode(rtMusic));
HTTPGet('http://' + BREAKAWAY_IP + ':8282/parameter/hd1/strm/metadata_strm?set=' + URLEncode(rtMusic));
end;
if (ItemType = pitCommand) and (Item.GetArtist = 'RDSrt') then SetRuntimeData('CurrentProgram',Item.GetTitle);
if (ItemType = pitCommand) and (Item.GetArtist = 'RDSps') then HTTPGet('http://' + BREAKAWAY_IP + ':8282/parameter/fm1/misc/rds_ps?set=' + URLEncode(Item.GetTitle));
end;
end;
procedure OnItemStop(Item: IPlaylistItem; Region: byte; OnAir: boolean; UniqueID: string; Duration: TTimeValue);
var
ItemType : TPlaylistItemType;
begin
if OnAir = true then begin
ItemType := Item.GetItemType;
if ItemType = pitTraffic then HTTPGet('http://' + BREAKAWAY_IP + ':8282/parameter/fm1/misc/rds_ta=0'); // RDS TA (traffic)
end;
end;