How to build an advanced Playlist Template

If you wish to be even more creative with playlist generation you will need to look at building advanced Playlist Template files. One of the main benefits of advanced template building is that you can create template files which are very selective. For example, you can create a template file that will generate a list of three Rock songs, followed by three Pop songs, followed by five of your Favorite songs, etc.

In this tutorial we are going to create a two hour playlist consisting of three Rock songs, followed by 3 Pop songs, followed by 4 of your Favorite songs, followed by 2 songs released in the 1980s, followed by 2 songs released in the 2000s.

We have built a Playlist Template, see below, that follows the above scenario. For this template to work you will need to make sure that the following categories exist in your Media Library, and that they are populated; Rock, Pop, Favorites, 1980s, and 2000s. For instructions on creating categories click here. For instructions on populating your categories click here.

We have color coded the Playlist Template components to help with identifying the various components. For more details on Playlist Template components click here.

Fuchsia highlights the global option.

Green highlights the compulsory item queries.

Black highlights the comments within the template. Comments are preceded by the # symbol, which causes OtsAV to ignore the entire comment line.

 

Closer look at the ~length global option

The ~length hours=2 component tells OtsAV to generate a two hour playlist. You are able to vary the playlist length by altering the hourly amount. For example ~length hours=4 will generate a playlist that is four hours in length. Instead of specifying the length in time you can specify the number of items you wish to have in the playlist, e.g. ~length items=150 will create a playlist comprising of 150 items. For more details on the global options available click here.

 

Closer look at an Item Query

Before we go any further we will take a closer look at the components of one of the template's item queries.

#Tells OtsAV to select three Rock songs.

~iq=3 avail & Rock & rating > 0 & itemsep artist > 20 & itemsep title > 20 & lastplay > 12 hours

 

#Tells OtsAV...: This is a comment line, which will be ignored by OtsAV when generating the playlist.

 

~iq=3: Tells OtsAV to select three items/songs from the category specified.

 

avail: Tells OtsAV to only select items that are available, items which are unavailable will be ignored.

 

Rock: Tells OtsAV the category that the items are to be selected from.

 

rating > 0: Tells OtsAV to select items with a rating greater than zero. Items with a rating of zero are ignored.

itemsep artist > 20: Tells OtsAV to place at least 20 items of spacing between the same artists.

itemsep title > 20: Tells OtsAV to place at least 20 items of spacing between the same titles.

lastplay > 12 hours: Tells OtsAV to ignore items that have been played in the last 12 hours.

Note: If you are not worried about repeating items you can simplify this item query even further, e.g. ~iq=3 avail & Rock & rating > 0 will find three available Rock songs.

For more details on the components of a Playlist Template click here.

 

 

#START

# Global options:

# Tells OtsAV to generate a playlist of 2 hours.

~length hours=2

 

#Tells OtsAV to select four Rock songs.

~iq=3 avail & Rock & rating > 0 & itemsep artist > 20 & itemsep title > 20 & lastplay > 12 hours

 

#Tells OtsAV to select three Pop songs.

~iq=3 avail & Pop & rating > 0 & itemsep artist > 20 & itemsep title > 20 & lastplay > 12 hours

 

#~iq=4 tells OtsAV to select four of your Favorite songs.

~iq=4 avail & Favorites & rating > 0 & itemsep artist > 20 & itemsep title > 20 & lastplay > 12 hours

 

#~iq=2 tells   OtsAV to select four 1980s songs.

~iq=2 avail & 1980s & rating > 0 & itemsep artist > 20 & itemsep title > 20 & lastplay > 12 hours

 

#~iq=3 tells OtsAV to select four 2000s songs.

~iq=3 avail & 2000s & rating > 0 & itemsep artist > 20 & itemsep title > 20 & lastplay > 12 hours

# FINISH

 

If you receive a parsing error message it will most probably because the category names listed in the template do not match the listing in the Media Library. You will need to correct the category name in the Media Library.

If your playlist is showing Placeholders it is most probably because your categories do not contain enough items/songs for the rules that are set in the template. You may need to reduce the artist and title separation rules or reduce the lastplay time.

You are able to advance this example Playlist Template further to produce powerful playlist templates. For further inspiration please see the following topics Ots Playlist Template (OTM) Format, and Ots Media Query Language (OMQL).

 

Related Topics:

Ots Playlist Template (OTM) Format

Scheduling & Logging

How to configure Scheduling & Logging