Smart playlists: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
No edit summary
(47 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{:Smart_playlists/Contents}}
{{mininav|[[Playlists]] }}
{{mininav|[[Playlists]] }}
<section begin="intro"/>XBMC supports '''smart playlists''' for all types of media (excluding pictures), which essentially use a set of rules to limit the results from the [[XBMC databases|databases]]. This means that to be able to create a smart playlist in the GUI, music/video ''must'' first be added to the libraries using a [[Scrapers|scraper]] [[Add-ons|addon]] or by creating [[NFO files]]. Smart playlist can be created either by using the built-in GUI smart playlist editor accessible from the [[Playlists]] section, or by creating an [[w:XML|XML]] file with the extension XSP ('''X'''BMC '''S'''mart '''P'''laylist).<section end="intro"/>


== Creating a smart playlist in the GUI ==
=== Smart playlist for music ===
{{highlight|Music -> Playlists -> New smart playlist|bordered=yes}}


<gallery widths=600px heights=340px>
== Introduction ==
Image:Musicxsp1.png|{{big|'''Step 1:'''}} Select "Music" on main menu.
<section begin="intro"/>Smart Playlists are a versatile feature that allow you to create customised lists of media that may be more suited to your browsing preference. They are a set of rules/filters that allow you to display a sub set of the media in your library.<section end="intro"/>
Image:Musicxsp2.png|{{big|'''Step 2:'''}} Select "Playlists" from the options.
Image:Musicxsp3.png|{{big|'''Step 3:'''}} Select "New smart playlist" from the options.
Image:Musicxsp4.png|{{big|'''Step 4:'''}} Fill in with the desired options and when done press OK.
</gallery>


=== Smart playlist for video ===
Once a smart playlist is created, it can be browsed like any other list in the {{kodi}} library.
{{highlight|Video -> Playlists -> New smart playlist|bordered=yes}}


<gallery widths=600px heights=340px>
A Smart Playlist can also be set as a menu item on the main menu using any compatible skin. See: '''''[[Custom home items]]'''''
Image:Videoxsp1.png|{{big|'''Step 1:'''}} Select "Videos" on main menu.
Image:Videoxsp2.png|{{big|'''Step 2:'''}} Select "Playlists" from the options.
Image:Videoxsp3.png|{{big|'''Step 3:'''}} Select "New smart playlist" from the options.
Image:Videoxsp4.png|{{big|'''Step 4:'''}} Fill in with the desired options and when done press OK.
</gallery>


== Party Mode playlists ==
'''Notes:'''
{{see|Party Mode}}
* Smart Playlists work by using the information in the databases. A correctly scanned/scraped library is required for accurate results
* It is not possible to combine different classes of media into a playlist. eg you cannot combine Movies and TV Shows. The only combining allowed is Music and Music Videos as these may share a common Artist


== Format of a smart playlist file ==
These pages are a basic guide to help you understand the process of creating a smart playlist. The easiest way to discover the power of smart playlists is to create and test. Create as many as you like, they can all be deleted and there is no effect on the rest of your setup.
Smart playlists are plain text files that can be parsed by an XML reader (e.g. [[w:Visual_studio|Visual Studio]] and [[w:Notepad%2B%2B|Notepad++]]). Any text editor can be used to create them. They should be saved with the extension XSP and placed in your [[userdata]] directory, as there is only limited support for smart playlists saved outside of the userdata folder.


The format is as follows:
<syntaxhighlight lang="xml" enclose="div">
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="songs">
    <name>All U2 from after 1990</name>
    <match>all</match>
    <rule field="artist" operator="is">
        <value>U2</value>
    </rule>
    <rule field="year" operator="greaterthan">
        <value>1990</value>
    </rule>
    <limit>50</limit>
    <order direction="descending">playcount</order>
</smartplaylist>
</syntaxhighlight>


=== Types ===
== Methods ==
Smart playlists can be of one of the following types:
Playlists can be created and edited using either of the two following methods :
* songs (default)
* albums
* movies
* tvshows
* episodes
* musicvideos
* mixed (audio and music videos)


<syntaxhighlight lang="xml" enclose="div">
{{big|'''[[Smart_playlists/GUI Method|GUI Method]]'''}} - Create and edit playlists directly in {{kodi}} using the playlist editor
<smartplaylist type="songs">
</syntaxhighlight>


=== Name and Match ===
{{big|'''[[Smart_playlists/XSP Method|XSP Method]]'''}} - Advanced users can create and edit the XSP files located in the '''[[userdata]]\playlists''' folder
Basically there are two header tags, <code><name></code> and <code><match></code> and then a set of <code><rule></code> tags that define the rules to use, along with an <code><order></code> tag to allow sorting and a <code><limit></code> tag to limit the returned results.
{{Note|that the tags and attributes are all case-sensitive.}}  
The <code><name></code> tag is the name of the playlist and the <code><match></code> tag indicates how the <code><rule></code> tags should be matched. If <code><match>all</match></code> like in the above example, then only songs which satisfy all the <code><rule></code>'s will be included. If <code><match>one</match></code> is specified, then songs that satisfy any one (or more) of the <code><rule></code>'s will be included.


<syntaxhighlight lang="xml" enclose="div">
Also...
<name>All U2 from after 1990</name>
<match>all</match>
</syntaxhighlight>


=== Rules ===
: '''[[Smart_playlists/Rules_and_groupings|Rules & Groupings]]''' - A list of Rules, Fields, Operators and Values that can be used in the XSP files
The <code><rule></code> tags, of which there can be as many as you wish, have two attributes (<code>field</code> and <code>operator</code>) and a <code><value></code> tag.


<syntaxhighlight lang="xml" enclose="div">
: '''[[Smart_playlists/Examples|Example XSP files]]''' - Example XSP files that can be copied into your own setup
<rule field="artist" operator="is">
    <value>U2</value>
</rule>
</syntaxhighlight>


==== Fields ====
Depending on the type of the smart playlist different <code>field</code>s are available:
{| class="prettytable" style="margin-right: 0;"
!colspan="2"|<code>field</code>
!colspan="3"|music
!colspan="4"|video
!colspan="1"|type
|-
!style="padding-left: 5px; padding-right: 10px;"|Name
!style="padding-left: 10px; padding-right: 10px;"|Data type
!style="padding-left: 10px; padding-right: 10px;"|songs
!style="padding-left: 10px; padding-right: 10px;"|albums
!style="padding-left: 10px; padding-right: 10px;"|artists
!style="padding-left: 10px; padding-right: 10px;"|movies
!style="padding-left: 10px; padding-right: 10px;"|tvshows
!style="padding-left: 10px; padding-right: 10px;"|episodes
!style="padding-left: 10px; padding-right: 10px;"|musicvideos
!style="padding-left: 10px; padding-right: 10px;"|mixed
|-
|style="padding-left: 5px;"|genre
|string
|{{yes}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|album
|string
|{{yes}}
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|artist
|string
|{{yes}}
|{{yes}}
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|albumartist
|string
|{{yes}}
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|title
|string
|{{yes}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{no}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|year
|number
|{{yes}}
|{{yes}}
|{{no}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|time
|number
|{{yes}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{yes}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|tracknumber
|number
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|filename
|string
|{{yes}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{yes}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|path
|string
|{{yes}}
|{{no}}
|{{no}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|playcount
|number
|{{yes}}
|{{no}}
|{{no}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|lastplayed
|date
|{{yes}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{yes}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|inprogress
|boolean
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{yes}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|rating
|number
|{{yes}}
|{{yes}}
|{{no}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|comment
|string
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|dateadded
|date
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|-
|style="padding-left: 5px;"|plot
|string
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|plotoutline
|string
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|tagline
|string
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|mpaarating
|string
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|top250
|number
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|status
|string
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|votes
|number
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|director
|string
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|actor
|string
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|studio
|string
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|country
|string
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|numepisodes
|number
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|numwatched
|number
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|writers
|string
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{yes}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|airdate
|date
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|episode
|number
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|season
|number
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|tvshow
|string
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{yes}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|episodetitle
|string
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|review
|string
|{{no}}
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|themes
|string
|{{no}}
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|moods
|string
|{{no}}
|{{yes}}
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|styles
|string
|{{no}}
|{{yes}}
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|type
|string
|{{no}}
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|label
|string
|{{no}}
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|hastrailer
|boolean
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|videoresolution
|number
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{yes}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|audiochannels
|number
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{yes}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|videocodec
|string
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{yes}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|audiocodec
|string
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{yes}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|audiolanguage
|string
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{yes}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|subtitlelanguage
|string
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{yes}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|videoaspect
|number
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{yes}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|set
|string
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|-
|style="padding-left: 5px;"|tag
|string
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{yes}}
|{{no}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|instruments
|string
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|-
|style="padding-left: 5px;"|biography
|string
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|-
|style="padding-left: 5px;"|born
|string
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|-
|style="padding-left: 5px;"|band formed
|string
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|-
|style="padding-left: 5px;"|disbanded
|string
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|-
|style="padding-left: 5px;"|died
|string
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|-
|style="padding-left: 5px;"|playlist
|string
|{{yes}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{yes}}
|-
|}


===== Field values =====
{| class="prettytable" style="margin-right: 0;"
! <code>field</code>
! value description
|-
| audiolanguage
| A three letter [http://en.wikipedia.org/w/index.php?title=List_of_ISO_639-2_codes ISO 639-2/'''B''']  value in ''lowercase'' (usually the first three letters of the language name in English). An uppercase value will be ''ignored'' and produce an empty playlist.
|-
|-
| subtitlelanguage
| A three letter [http://en.wikipedia.org/w/index.php?title=List_of_ISO_639-2_codes ISO 639-2/'''B'''] value in ''lowercase'' (usually the first three letters of the language name in English). An uppercase value will be ''ignored'' and produce an empty playlist.
|-
|}
==== Operators ====
The <code>operator</code> attribute specifies the rule that should be used to match the parameter to the <code>field</code>. All matching is done case-insensitive. The allowed <code>operator</code>s are:
{| class="prettytable" style="margin-right: 0;"
! <code>operator</code>
! Definition
|-
| contains
| True if the field contains the parameter as a substring
|-
| doesnotcontain
| True if the field does not contain the parameter as a substring
|-
| is
| True if the field matches the parameter exactly
|-
| isnot
| True if the field does not match the parameter exactly
|-
| startswith
| True if the start of the field matches the parameter
|-
| endswith
| True if the end of the field matches the parameter
|-
| lessthan
| True if the content of the field is less than the parameter
|-
| greaterthan
| True if the content of the field is greater than the parameter
|-
| after
| True if the content of the field comes after the parameter
|-
| before
| True if the content of the field comes before the parameter
|-
| inthelast
| True if the field falls in the last range specified by the parameter. Only applicable for a date field.
|-
| notinthelast
| True if the field does not fall in the last range specified by the parameter. Only applicable for a date field.
|}
=== Limit and Order ===
The <code><limit></code> tag simply takes a number of songs as it's limit. A missing limit tag, or <code><limit>0</limit></code> will retrieve all matching songs. The <code><order></code> tag has a <code>direction</code> attribute, the values of which can be <code>ascending</code> or <code>descending</code>, and it's value is a field as above, or can be <code><order>random</order></code> if you want a random ordering returned. Note that random should be used with care - it is quite slow if the returned results from the <code><rule></code> sets is large (more than 500 items).
The above example, therefore selects all songs whose artist field is U2 and whose year field is greater than 1990, orders them by the number of times they've been played (most played first) then limits it to just 50. Thus, the top 50 songs you've played from all U2 songs published after 1990.
<syntaxhighlight lang="xml" enclose="div">
<limit>50</limit>
<order direction="descending">playcount</order>
</syntaxhighlight>
=== Grouping ===
Grouping was added in XBMC v13. The <code><group></code> tag allows to group the resulting list of media items by a specific category. The final list will consist of folder nodes containing matching media items. Depending on the type of the Smart Playlist the following grouping categories exist:
{| class="prettytable" style="margin-right: 0;"
!colspan="2"|<code>field</code>
!colspan="3"|music
!colspan="4"|video
!colspan="1"|
|-
!style="padding-left: 5px; padding-right: 10px;"|Name
!style="padding-left: 10px; padding-right: 10px;"|Data type
!style="padding-left: 10px; padding-right: 10px;"|songs
!style="padding-left: 10px; padding-right: 10px;"|albums
!style="padding-left: 10px; padding-right: 10px;"|artists
!style="padding-left: 10px; padding-right: 10px;"|movies
!style="padding-left: 10px; padding-right: 10px;"|tvshows
!style="padding-left: 10px; padding-right: 10px;"|episodes
!style="padding-left: 10px; padding-right: 10px;"|musicvideos
!style="padding-left: 10px; padding-right: 10px;"|mixed
|-
|style="padding-left: 5px;"|none
|string
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|-
|style="padding-left: 5px;"|genres
|string
|{{no}}
|{{no}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{no}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|years
|string
|{{no}}
|{{yes}}
|{{no}}
|{{yes}}
|{{yes}}
|{{no}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|actors
|string
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{no}}
|{{no}}
|-
|style="padding-left: 5px;"|artists
|string
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|directors
|string
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|writers
|string
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{yes}}
|{{no}}
|{{no}}
|-
|style="padding-left: 5px;"|studios
|string
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{yes}}
|{{no}}
|{{yes}}
|{{yes}}
|-
|style="padding-left: 5px;"|countries
|string
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|-
|style="padding-left: 5px;"|sets
|string
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{no}}
|{{no}}
|{{no}}
|{{no}}
|-
|style="padding-left: 5px;"|tags
|string
|{{no}}
|{{no}}
|{{no}}
|{{yes}}
|{{yes}}
|{{no}}
|{{yes}}
|{{yes}}
|-
|}
{{Notice|There's an important difference between not providing a <code><group></code> tag (or providing an empty <code><group></code> tag) and setting the value of the <code><group></code> tag to '''none''': The latter will overrule any mixed grouping that would be applied by default to a list of media items (specifically for a mixed list of movies and [[movie sets]] if the setting ''Group movies into sets'' is enabled).}}
==== Mixed grouping ====
For the '''sets''' grouping category there is support for additional so called mixed grouping. The difference to normal grouping is that the resulting list will not just be a list of grouped folders but a mix of media items and grouped folders. Mixed grouping can be controlled using the '''mixed''' attribute in the <code><group></code> tag with a boolean value (''true'' or ''false'').
== Combining playlists ==
The <code>playlist</code> <code>field</code> can be used to combine several playlists together. When playlists are combined, the <code><limit></code> and <code><order></code> tags of the included playlists are ignored; only the <code><order></code> and <code><limit></code> of the final playlist are used.
As a simple example, lets create a new playlist combining the "Rock Music from the 1970s" and "Recently Played Songs" playlists above, to produce a playlist with the recently played rock songs from the 1970s.
'''Recently played rock tracks from the 1970s'''
<syntaxhighlight lang="xml" enclose="div">
<?xml version="1.0"?>
<smartplaylist type="songs">
  <name>Recently played  Rock Tracks from the 1970s</name>
  <match>all</match>
  <rule field="playlist" operator="is">Rock Music from the 1970s</rule>
  <rule field="playlist" operator="is">Recently Played Songs</rule>
</smartplaylist>
</syntaxhighlight>
Using this system allows very complex queries to be built. Note that in a single playlist, you can only match ALL of the rules, or ONE (or more) of the rules. This is basically either ANDing the conditions together, or ORing them together. You cannot mix AND with OR in a single playlist. To build up a playlist with both AND and OR operations on the rules, you use multiple playlists to group the AND operations and the OR operations, then combine them as above.
== Examples ==
=== Movie examples ===
==== One random movie ====
Only ''one'' movie is added to the playlist. This isn't possible to create in the GUI because the lower limit is 10 (or at least the limit needs to be edited afterward).<br />
Even though the limit is only ''one'' you still need to set ''random'' order.
Though the difference between a playlist containing the GUI minimum 10 or edited to contain only 1 isn't significant. Pressing play on both of them will play a random movie. The "benefit" with a playlist only containing one movie is that you'll only be presented with one if you open the playlist.
<syntaxhighlight lang=xml>
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="movies">
    <name>Random movie</name>
    <match>all</match>
    <rule field="playcount" operator="is">
        <value>0</value>
    </rule>
    <limit>1</limit>
    <order direction="ascending">random</order>
</smartplaylist>
</syntaxhighlight><br />
==== Movies with a specific subtitle language ====
Movies that contain Swedish (swe) internal subtitles.
<syntaxhighlight lang=xml>
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="movies">
    <name>Movies with Swedish subs</name>
    <match>all</match>
    <rule field="subtitlelanguage" operator="is">
        <value>swe</value>
    </rule>
    <group>none</group>
</smartplaylist>
</syntaxhighlight>
=== Music examples ===
==== Recently played songs ====
<syntaxhighlight lang="xml" enclose="div">
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="songs">
    <name>Recently Played Songs</name>
    <match>all</match>
    <rule field="lastplayed" operator="inthelast">
        <value>2 weeks</value>
    </rule>
    <order direction="descending">lastplayed</order>
</smartplaylist>
</syntaxhighlight>
==== Top 100 songs ====
<syntaxhighlight lang="xml" enclose="div">
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="songs">
    <name>Top 100 Songs</name>
    <match>all</match>
    <rule field="playcount" operator="greaterthan">
        <value>0</value>
    </rule>
    <order direction="descending">playcount</order>
    <limit>100</limit>
</smartplaylist>
</syntaxhighlight>
==== Rock music from the 1970s ====
<syntaxhighlight lang="xml" enclose="div">
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="songs">
    <name>Rock Music from the 1970s</name>
    <match>all</match>
    <rule field="genre" operator="is">
        <value>Rock</value>
    </rule>
    <rule field="year" operator="greaterthan">
        <value>1969</value>
    </rule>
    <rule field="year" operator="lessthan">
        <value>1980</value>
    </rule>
</smartplaylist>
</syntaxhighlight><br />
=== TV show examples ===
==== Last played episodes (history) ====
Not ''in progress'' episodes and with a ''playcount'' bigger than 0 from the last ''6 months'' ordered by ''lastplayed''.
<syntaxhighlight lang="xml" enclose="div">
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="episodes">
    <name>Last played episodes (history)</name>
    <match>all</match>
    <rule field="lastplayed" operator="inthelast">
        <value>6 months</value>
    </rule>
    <rule field="inprogress" operator="false" />
    <rule field="playcount" operator="greaterthan">
        <value>0</value>
    </rule>
    <order direction="descending">lastplayed</order>
</smartplaylist>
</syntaxhighlight>
==== Last played episodes ====
Episodes that are still ''in progress'' from the last ''2 weeks'' ordered by ''lastplayed''.
<syntaxhighlight lang="xml" enclose="div">
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="episodes">
    <name>Last played episodes</name>
    <match>all</match>
    <rule field="lastplayed" operator="inthelast">
        <value>2 weeks</value>
    </rule>
    <rule field="inprogress" operator="true" />
    <order direction="descending">lastplayed</order>
</smartplaylist>
</syntaxhighlight>
==== Last played TV shows ====
TV shows that've been played in the last ''6 months'' ordered by ''lastplayed''.
<syntaxhighlight lang="xml" enclose="div">
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="tvshows">
    <name>Last played TV shows</name>
    <match>all</match>
    <rule field="lastplayed" operator="inthelast">
        <value>6 months</value>
    </rule>
    <order direction="descending">lastplayed</order>
</smartplaylist>
</syntaxhighlight>
==== TV show with specific episode names ====
A playlist with The Simpsons' ''Treehouse of Terror'' episodes.
<syntaxhighlight lang="xml" enclose="div">
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="episodes">
    <name>The Simpsons - Treehouse of Horror</name>
    <match>all</match>
    <rule field="title" operator="contains">
        <value>Treehouse</value>
    </rule>
    <rule field="tvshow" operator="is">
        <value>The Simpsons</value>
    </rule>
</smartplaylist>
</syntaxhighlight>
==== Random unplayed episodes from a TV show ====
''10 random'' episodes with a ''playcount of 0'' (i.e. unplayed) from The Simpsons.
<syntaxhighlight lang="xml" enclose="div">
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="episodes">
    <name>Random episodes - The Simpsons</name>
    <match>all</match>
    <rule field="tvshow" operator="is">
        <value>The Simpsons</value>
    </rule>
    <rule field="playcount" operator="is">
        <value>0</value>
    </rule>
    <limit>10</limit>
    <order direction="ascending">random</order>
</smartplaylist>
</syntaxhighlight>
==== Random episodes from several TV shows ====
''10 random'' episodes with a ''playcount of 0'' from six different shows. Though as it's random this can create a list with two to ten episodes of the same show in a row.
If you specifically want to watch 6 random episodes from 6 different shows you could create playlists that are limited to 1 episode and 1 show (see [[Smart_playlists#One_random_movie|One random movie]] example) . Then you queue the 6 playlists.
<syntaxhighlight lang="xml" enclose="div">
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="episodes">
    <name>Random episodes - AAFFSS</name>
    <match>all</match>
    <rule field="tvshow" operator="is">
        <value>American Dad</value>
        <value>Archer</value>
        <value>Family Guy</value>
        <value>Futurama</value>
        <value>South Park</value>
        <value>The Simpsons</value>
    </rule>
    <rule field="playcount" operator="is">
        <value>0</value>
    </rule>
    <limit>10</limit>
    <order direction="ascending">random</order>
</smartplaylist>
</syntaxhighlight>
== Notes ==
<references/>
{{Gotham updated}}


{{updated|18}}
[[Category:Index]]
[[Category:Guides]]
[[Category:Manual]]
[[Category:Karellen]]
[[Category:Video library]]
[[Category:Video library]]
[[Category:Music library]]
[[Category:Music library]]
[[Category:Advanced topics]]

Revision as of 20:20, 16 November 2020

Smart Playlists Contents

Home icon grey.png   ▶ Playlists ▶ Smart playlists


Introduction

Smart Playlists are a versatile feature that allow you to create customised lists of media that may be more suited to your browsing preference. They are a set of rules/filters that allow you to display a sub set of the media in your library.

Once a smart playlist is created, it can be browsed like any other list in the Kodi library.

A Smart Playlist can also be set as a menu item on the main menu using any compatible skin. See: Custom home items

Notes:

  • Smart Playlists work by using the information in the databases. A correctly scanned/scraped library is required for accurate results
  • It is not possible to combine different classes of media into a playlist. eg you cannot combine Movies and TV Shows. The only combining allowed is Music and Music Videos as these may share a common Artist

These pages are a basic guide to help you understand the process of creating a smart playlist. The easiest way to discover the power of smart playlists is to create and test. Create as many as you like, they can all be deleted and there is no effect on the rest of your setup.


Methods

Playlists can be created and edited using either of the two following methods :

GUI Method - Create and edit playlists directly in Kodi using the playlist editor

XSP Method - Advanced users can create and edit the XSP files located in the userdata\playlists folder

Also...

Rules & Groupings - A list of Rules, Fields, Operators and Values that can be used in the XSP files
Example XSP files - Example XSP files that can be copied into your own setup