Scripts - My Offerings

Due to popular demand, here’s some of the scripts I have lurking here…

Load Current Hour’s Playlist - for loading upon a restart or during the hour

[code]// Load the current hour’s Playlist
// Useful for logs created with StationPlaylist Creator

// by Charlie Davy

begin
Playlist(0).LoadFromM3U(‘C:\Playlists’ + FormatDateTime(‘ddd dd mmm - hh’, now) + ‘.m3u’);
SystemLog(‘Loaded Current Playlist ’ + FormatDateTime(‘ddd dd mmm - hh’, now) + ’ for playout/automation…’);
end.[/code]

Load Next Hour’s Playlist - suitable for running a few minutes before the hour

[code]// Load the next hour’s Playlist (current hour + 1)
// Useful for logs created with StationPlaylist Creator

// by Charlie Davy

begin
Playlist(0).LoadFromM3U(‘C:\Playlists’ + FormatDateTime(‘ddd dd mmm - hh’, now + 0.04166) + ‘.m3u’);
SystemLog(‘Loaded Next Playlist ’ + FormatDateTime(‘ddd dd mmm - hh’, now + 0.04166) + ’ for playout/automation…’);
end.
[/code]

Line Input Control

[code]// Open Line Input
// by Charlie Davy

// Mixer(0) is the default playback device as per Control Panel
// 12 is my Line Input “play through” mute option
// Yours may differ!

begin
Mixer(0).UnMute(0, 12);
SystemLog(‘Satellite Feed ACTIVE …’);
end.

// Close News Channel
// by Charlie Davy

begin
Mixer(0).Mute(0, 12);
SystemLog(‘Satellite Feed DISABLED …’);
end.[/code]

Load Tomorrow’s Playlist

begin Playlist(0).LoadFromM3U('C:\PLAYLISTS\' + FormatDateTime('yyyymmdd', now + 0.04166) + '.m3u'); SystemLog('Loaded Next Playlist ' + FormatDateTime('ddd dd mmm - hh', now + 0.04166) + ' for playout/automation...'); end.

Load 2 advert playlists into Playlist 2+3 for split feeds

begin Playlist(1).LoadFromM3U('C:\ADLOGS - FM\' + FormatDateTime('ddd dd mmm - hh', now) + '.m3u'); Playlist(2).LoadFromM3U('C:\ADLOGS - AM\' + FormatDateTime('ddd dd mmm - hh', now) + '.m3u'); SystemLog('Loaded Advert Playlists for playout/automation...'); end.

Set Item Attributes - the magic marker!

[code]// Set Item Attributes
// Remove the comments to perform a task
// by Charlie Davy

// Drag all common items into a Playlist and run this script
// Enable CueStart and FadeOut options for this to top and tail your audio

var
i: integer;

begin
for i := 0 to CurrentPlaylist.GetCount - 1 do

// If EndType is empty, then do it
//if CurrentPlaylist.GetItem(i).GetEndType = ‘o’ then

begin

// Set End Type to temporary - useful to indicate an automatically generated CueOut
//CurrentPlaylist.GetItem(i).SetEndType(‘e’);

// Set Playlist Icon
//CurrentPlaylist.GetItem(i).GetPicture.LoadFromFile(‘C:\Program Files\mAirList\icons\Icon - Advert.ico’);
//CurrentPlaylist.GetItem(i).GetPicture.LoadFromFile(‘C:\Program Files\mAirList\icons\Icon - Control.ico’);
//CurrentPlaylist.GetItem(i).GetPicture.LoadFromFile(‘C:\Program Files\mAirList\icons\Icon - Ident.ico’);
//CurrentPlaylist.GetItem(i).GetPicture.LoadFromFile(‘C:\Program Files\mAirList\icons\Icon - Pre Rec.ico’);
//CurrentPlaylist.GetItem(i).GetPicture.LoadFromFile(‘C:\Program Files\mAirList\icons\Icon - Promo.ico’);
//CurrentPlaylist.GetItem(i).GetPicture.LoadFromFile(‘C:\Program Files\mAirList\icons\Icon - Voicetrack.ico’);
//CurrentPlaylist.GetItem(i).GetPicture.LoadFromFile(‘C:\Program Files\mAirList\icons\Icon - Song.ico’);

// If you want to colour an item, use this line:
//CurrentPlaylist.GetItem(i).SetColored(true);

// Adverts and Promos
//CurrentPlaylist.GetItem(i).SetColor($80FF80);

//CurrentPlaylist.GetItem(i).SetArtist(‘Voicetrack’);
//CurrentPlaylist.GetItem(i).SetComment(‘This item can be overlayed with a song intro.’);

// Beds
//CurrentPlaylist.GetItem(i).SetColor($FFFF00);

// Jingles
//CurrentPlaylist.GetItem(i).SetColor($00FFFF);

// Pre Rec
//CurrentPlaylist.GetItem(i).SetColor($9EE0D3);

// VoiceTracks
//CurrentPlaylist.GetItem(i).SetColor($D3E09E);
//CurrentPlaylist.GetItem(i).SetColor($FF80FF);

// Save MMD Data File
//CurrentPlaylist.GetItem(i).SaveMMD;

end;
end.
[/code]

Cheers Charlie.

edit

Charlie, trying and struggling to make your load next hour script, load an ad playlist at defined points through the hour into the current playlist.

This works instantly:

begin
Playlist(0).LoadFromM3U(‘C:\wherever’ + FormatDateTime(‘hh’, now) + ‘.m3u’);
end.

But tried and failed to delay the loading so an ad playlist could be loaded a short period in advance like so:

begin
Playlist(0).LoadFromM3U(‘C:\wherever’ +

FormatDateTime(‘hh nn’, now + 5/(24 * 60) + ‘.m3u’);
end.

I had hoped this would load when run from the event editor at 15 minutes past the hour an ad break called hour 20.

For these sub playlists we may also need a naming convention such as a 3 digit number rather than in time format. I have also noticed the term InlinePlaylist in the help file, what is this?

Any thoughts.

Kind regards tony

Sorry, Tony - I missed this one!

Inline Files (according to the Wiki) are an XML file that will be part of mAirListDB.

I’ve not been following yours and Cad’s script ping-pong with regards to loading containers and playlists, so perhaps that’s the solution and I’m just late with reply, in which case - doh :frowning: Either way, Cad is probably the chap to solve the problem :wink:

[quote=“tony wilding, post:2, topic:5018”]tried and failed to delay the loading so an ad playlist could be loaded a short period in advance like so:

begin
Playlist(0).LoadFromM3U(‘C:\wherever’ +

FormatDateTime(‘hh nn’, now + 5/(24 * 60) + ‘.m3u’);
end.

I had hoped this would load when run from the event editor at 15 minutes past the hour an ad break called hour 20.

For these sub playlists we may also need a naming convention such as a 3 digit number rather than in time format.

Any thoughts.[/quote]

FIRST decide on your file naming formats. I’d personally suggest and recommend:
yyyy-mm-dd-hh-nn-xxx.m3u
where nn is minutes past hour and xxx is something like Ads, Promos, News, etc. May look long-winded but prevents all sorts of cocks-up … (‘is that today’s file, yesterday’s, or tomorrow’s?’)

THEN amend your scripts etc. to suit. If you are using Events anyway, why not write one script per ad break time? Easier than trying to shoehorn everything into one script and hardly a lot of extra work! :slight_smile: Then plot your hourly events, one per script/time combination.

Doing things the other way around (scripts first, filenames later) is asking for trouble later down the line (BTDTGTTS).

So, for example to load a 20-mins-past-hour ad break playlist using my suggested naming system, you would write:

begin
  Playlist(0).LoadFromM3U(
    'C:\wherever\' + 
    FormatDateTime('yyyy-mm-dd-hh-', now)
    + '20'
    + '-Ads.m3u'
    );
end.

For 40 past hour, copy the script and change the 20 to a 40, and so on. This way, you are only relying on the HOUR part of ‘now’ and not jumping through hoops to compute correct times. It’s also much easier for anyone else looking at the script to see precisely which M3U you are attempting to load! And there is no way you could accidentally load the 40-past list at 20 past, for example.

Note that I deliberately split up the file name on to several lines, to make it easier to amend later. ;D

If you want to use a different file naming system, change the script to suit, but trust me on this: DO sort out your naming conventions FIRST!

(Good programming and systems practice … you can’t buy this stuff! ;))

BFN
CAD

Cheers both. Cad I will give the script a whirl when home again for more than sleep. Last shift tonight until Friday.

Kind regards Tony

Hi Cad, not yet tried your script but here is 1 using various parts of the ads and news script and Charlie’s next hour.

This script appends the current playlist by 1 hour so is useful for loading the next hour at about 20 to the hour:

[code]begin
// Insert Playlist
//Tony Wilding
CurrentPlayList.Appendplaylist(Factory.CreatePlayListFromFile(‘C:\playlists’ + FormatDateTime(‘ddd hh’,now + 0.04166) + ‘.m3u’));

end.[/code]

Note is use of a simple playlist naming format of Day & Hour while tesing. So a start to something more useful hopefully.

Kind regards tony

Hi, any reason why this as an item attribute inside a script

// PSA item.SetColor($FFFF00);
returns light blue and not yellow?

Kind regards Tony

hi,

Torben wrote this at another place:

you have to write the color in reverse order. it’s not $RGB, the right one should be $BGR… in your case:

// PSA item.SetColor($00FFFF);

michi

cheers Michi, thought it was just me!

Struggling with other colors too, such as orange.

Is there anywhere with a color chart for this?

Kind regards tony

Google is your chum: http://www.w3schools.com/Html/html_colors.asp

My Color creator may also help: http://forum.mairlist.com/index.php/topic,2766.0.html You can pick the colours and they’ll save to a skin.ini in the app folder. I can make the #FFFFFF codes visble so that you can pick a colour from the Windows palette and then copy/paste the code ?

Hi Charlie, the problem seems to be html colours when specifying a colour for audio categories from inside a playlist.

$FFFF00 which should return yellow comes back as blue.

Kind regards Tony

Yeah, I had a few problems specifying certain colours… The 2 yellows and the 2 greens were where I was having trouble. If I set it in mAirList, then extracted the colour from the MMD file and pasted that into my “Bulk Set Attributes” script, the colour would be the one below it on the palette. I’ve highlighted the relevant colours in my image below.

I’ve re-done the colour app - it’s attached, you can easily highlight the HTML colour code now :slight_smile:


colours.zip (10.8 KB)

palette.png

As Michi stated if we reverse the rgb components we get the color asked for.

FFFF66 when reversed to 66FFFF and inserted into the script returns yellow.

Orange which in html would be FF8000 becomes 0008FF. Playing with these values gives various shades too.

Kind Regards Tony

i think you have to write the components of the colors in reverse order…

in case of orange: $FF8000, FF is the red fraction, 80 is the green fraction and 00 is the blue fraction of the whole statement…

so the html color $FF8000 would be in mairlist: $0080FF…

(untestet, its only my theory :wink: )

michi

Hi Michi, either will produce a shade of orange (mine nearer to red).

Kind Regards Tony

i found the thread with the statement from torben:

http://forum.mairlist.com/index.php/topic,2356.msg14085.html#msg14085

hope this helps :wink:

Cheers Michi.

Kind Regards Tony

[quote=“Charlie, post:1, topic:5018”]Due to popular demand, here’s some of the scripts I have lurking here…

Line Input Control

[code]// Open Line Input
// by Charlie Davy

// Mixer(0) is the default playback device as per Control Panel
// 12 is my Line Input “play through” mute option
// Yours may differ!

begin
Mixer(0).UnMute(0, 12);
SystemLog(‘Satellite Feed ACTIVE …’);
end.

// Close News Channel
// by Charlie Davy

begin
Mixer(0).Mute(0, 12);
SystemLog(‘Satellite Feed DISABLED …’);
end.[/code]

…[/quote]
I’ve just started using these two scripts and it’s working perfectly.

It might warrant a new thread, but I’m just trying to work out how to correctly use this and the load next hours playlist scripts together, so that everything is timed right (including a fixed time news jingle at XX:59:46)… I apologise if this has been covered before, but I’ve not been able to turn anything up on a search.

Many thanks!

Did you realize that this is also possible through actions? Might be easier to set up if it’s only attached to an event etc.

Did you realize that this is also possible through actions? Might be easier to set up if it’s only attached to an event etc.[/quote]
Funnily enough, I’ve just found that when adding an event to run the script! Will try that one too - thanks. :slight_smile:

I’ve setup five events… Play News Jingle and Disable Automation, Open Satellite Feed, Load Playlist, Enable and Start Automation, Close Satellite Feed and it’s spot on. (Just wish some of the Newslink ads weren’t so close - don’t want to cut off “that’s the latest”).