Commands are an extremely powerful aspect of Myriad 5 Playout that not that many people know how to use to get the most of the system.

Think of commands as a toolkit that you can use to solve a wide range of challenges. Common uses for Commands include:

  • Run external programs
  • Play Favourites
  • Trigger hardware events
  • Manipulate the Log
  • Manipulate the Media Library (import audio, copy Media etc)
  • Change 'On Air Control'
  • Control Media Players and Log playout
  • Control recordings
  • Send TCP / UDP messages to external equipment (is the network)
  • Trigger and step through SegueEdits
  • Control split playout (with Myriad Network SE)
  • Switch between Stations
  • Get simple 'system' information (such as time, date etc)

The real power of Commands comes from they fact that you can combine them using scripting language complete with simple logic achieve the results you need.


Consider the Command Script below:

#IF {System.GetCurrentDayOfWeek() = "Monday"}
 Players.PlayItem(-1,0,31)
#ELSE
 Players.PlayItem(-1,0,47)
#END


When triggered, this Command Script will play a certain Media Item on a Monday and a different Media Item every other day of the week.

 

Let's break it down line by line:

#IF {System.GetCurrentDayOfWeek() = "Monday"}

This first line uses the System.GetCurrentDayOfWeek() command to ask the PC what the day is. If the answer comes back as Monday then the line below will be triggered.

Players.PlayItem(-1,0,31)

This line uses the Players.PlayItem command which is used to play a specific Media Item. In the brackets, the first number is the Station ID you wan to use (0 means the default one, or you can set to -1 for teh 'currently active Station), the second number is the Media Player you want to use so if you changed this to 2 then it would use Media Player number 2. By setting this to 0 it will just use the first empty Media Player. The final number is the Media Item ID number that you want to be played so in this case it will play Media ID 31 (which could be a jingle that says 'Welcome to the Monday show'.

But what if it is Tuesday?

In that case the first line (the IF) would return Tuesday and therefore the condition would fail meaning it would move straight on to the #ELSE section so lets look at that:

...
#ELSE
 Players.PlayItem(-1,0,47)
....


The #ELSE signifies that the line below is what should happen if it is not Monday.

The line below is very similar to the PlayItem command we just looked at only this time the Media ID is set to number 47 meaning it will play whatever is in Media ID 47 (say a jingle that says 'It is not Monday).

Finally the #END signifies the end of the 'IF' command.

The IF / ELSE type of logic is one of the basic underpinnings of computer programming.

Commands can also be used to execute multiply things in sequence. In this example we are testing each day of the week and playing a specific jingle on that day:

#IF {System.GetCurrentDayOfWeek() = "Monday"}
 Players.PlayItem(-1,0,50)
#END
#IF {System.GetCurrentDayOfWeek() = "Tuesday"}
 Players.PlayItem(-1,0,51)
#END
#IF {System.GetCurrentDayOfWeek() = "Wednesday"}
 Players.PlayItem(-1,0,52)
#END
#IF {System.GetCurrentDayOfWeek() = "Thursday"}
 Players.PlayItem(-1,0,53)
#END
#IF {System.GetCurrentDayOfWeek() = "Friday"}
 Players.PlayItem(-1,0,54)
#END 

Each day would play a different Media ID. We missed off Saturday and Sunday in this example but hopefully you get the idea.

How to make a Command Media Item

Great so now we know the basic idea, how do we actually create a Media Item that will execute a Command?

In Myriad 5 Playout, Commands do not live independently (as they did in v4) but rather are actually a special type of Media Item that lives on the MediaWall but do not have any audio, just a Command Script.

The advantage to this is that once you have setup a Media Item as a Command, it can be triggered in any of the ways that you would normally play a Media Item ie:

  • Double click on the Media Wall
  • Drag into the Log (or a scheduled Log item)
  • Assign to a Favourite
  • Call from within another Command item
  • Attached to an audio marker (intro end, extro etc) in an audio Media Item

In fact the only thing you can't do is manually drag them into a Media Player (they don't have any audio).


So let's make one:

Add_a_media_item.png

Right click on an empty Media Item and select Edit  (or click on the Edit button on the ribbon if you prefer)

2_-_convert_media_to_command.png

 

Give your Media Item a suitable Title  and then click on the Command button on the Media Item Type tool bar (below the Description section) to convert from a standard Audio Media Item to a Command Media Item.

 

3_-_type_your_command.png

You can now type in your Command Script into the script area (black box) on the right hand side. You will also see a list of all available Commands in a 'tree view' on the left hand side.

  • Hover over a Command in the left hand side to see the properties for that Command.
  • Double click to add it to your Command script. 

4_-_command_tree.png

If you need a little more help with a specific Command, you can click on the Display Available Commands  button on the bottom of the window to access the full Command List.

5_--_command_help.png

So lets make a real world example!

6_-_an_example.png

You remember that in the first section we looked at a script that would play a certain jingle on a Monday and a different jingle every other day of the week?

The above example would do exactly that. In this example it would play whatever is in Media ID 31 on Mondays and whatever is in Media ID 47 every other day of the week.

7_-_adding_to_log.png

Here you can see the finished Command has been dragged into the Log and will be executed at the end of the Jamiroquai song. You can also drag a Command Media Item into a Favourite or simple double click on it to run it.

As these are just Media Items, it also means that your scheduling system can easily schedule them in place (as it is just a Media Item Number).

Adding Commands to audio markers in other Media Items

One of the other really useful aspects of Commands is the ability to attached them to the standard audio markers you find in Audio Media Items. These are:

  • Intro Start
  • Intro Mid
  • Intro End
  • Hook Start
  • Hook End
  • Extro

To attach a Command Media Item to one of these marker points, follow these steps:

  • Highlight the Media Item you want to attach the Command to and click on the Edit button on the MediaWall ribbon (or right click menu).
  • On the Edit Window, click on the View  tab.
  • Click on the Trigger Items  button to enable the Trigger Item boxes at the bottom of the screen.

 8_-_edit_triggers.png

Below each audio marker section (Intro Start etc) you will now see a simple number box. Use this to type in the Media Item ID you want to be triggered at that point.

9_set_trigger.png

 

So on the example above, then the Intro Start is reached, Myriad will also automatically play / execute whatever is in Media Item ID 50.

In the context of this blog, we would assume that Media Item 50 would contain an Command sequence we want to do but it could actually be another audio item and the system would just play that as well!

By combining Command with Audio Media Items you have an extremely powerful tool kit at you disposal. You could easily create a 'News' Media Item that combines audio for the new introduction and bed with Commands that switch on and off an external feed or 'bind' a message from a artist to the intro of their song.

But we still have not mentioned anything about turning on a stream

It has been a bit of a slog to get here but it was important to understand what Commands are and how they are used before tackling creating one to switch on and off a stream.

In this example we will use a Command to start an external application that will actually play the stream. In this case we will use the free VLC media player as it is a reliable and fast loading application.

So the first thing you need to do is download and install VLC player .

https://www.videolan.org/vlc/download-windows.en-GB.html

Once you have installed VLC player, it should look something like this:

10_-_vlc_player.png

Next you need to create two Command Media Items, one to start the stream and another to close it.

First click on the empty Media Item you want to use to create the start stream Command and click on Edit to open the Edit window.

Next click on the Command button to convert it to a Command Media Item:

11_-_command_buttonm.png

Now type or use the Command tree (on the left) to add following Command script:

External.Open(C:\Program Files\VideoLAN\VLC\vlc.exe, http://mp3streaming.planetwideradio.com:9110/PG96AAC )

In this case we will be using the External.Open command which is used to run an external application. In this case we want the Command to run the VLC application that we installed a few steps ago so we need to add the location for the application into the first section in brackets.

The second section (after the comma) is the location of the stream we want to open:

12_-_open_script.png

Once you have added this Command Script you can save the Media Item and close it.

Next we have to create the Command Media Item to kill the stream using a special feature in Windows.

13_-_kill_script.png

Open a blank Media Item using Edit,  give it a suitable Title  and convert it to a Command Media Item using the Command  button.

Now type in the follow script:

External.Open("taskkill", "/IM vlc.exe")

Once again we are using the External.Open command but this time we are using a tool that is built into Windows called 'taskkill' that can be used to close a running application. The IM vlc.exe tells taskkill to find an application called vlc.exe and 'kill it!

The result is that when this Command is run, VLC will immediately close.

14_-_COMMAND_ITEMS.png

 

Now we have two Media Items on the system that will start an external stream in VLC and kill it on demand. That may be enough but it also might sound a little abrupt on air so one options would be to combine these Command Media Items with an Audio Media Item that could mask the loading and killing of the stream.

If for example you had an Audio Media Item that announced the stream and then had a couple of seconds of audio and you attached the 'Start Stream' Command Item to an audio marker then you could cover any momentary delays in connecting. The same could be done at the end of the stream with a Media Item that runs the 'Kill Stream' Command at a set point in the middle of the audio to mask the rather abrupt ending.

With a bit of creative thinking and audio editing, you could make this sequence fairly slick.

Anything else you could do?

Of course. By combining Command Scripts you could do all sorts of clever things!

Consider the item below:

15_-_Stream_for_30_min.png

Here is the script in the Command:

Players.PlayItemToExtro(0,0,24)
External.Open(C:\Program Files\VideoLAN\VLC\vlc.exe, http://mp3streaming.planetwideradio.com:9110/PG96AAC )
Commands.Wait(1800)
External.Open(taskkill, /IM vlc.exe)
Players.PlayItemToExtro(0,0,25)

And here is what it will do:

  1. Play Media ID 24 until the Extro (eg the next line will not start until Media ID 24 has finshed playing).
  2. Start the stream.
  3. Wait for 1800 seconds (or 30 minutes to normal humans!)
  4. Kill the stream.
  5. Play Media ID 25 until the end.